Embedded Systems & RTOS – Exam and Interview
Notes
Quick-study edition • Prepared for exam and placement revision
Embedded Systems Basics
• An embedded system is a computing system designed for a dedicated function within a larger product.
• Typical blocks: processor/controller, memory, sensors/inputs, communication interfaces, actuators/outputs and power
supply.
• Important constraints include timing, memory, power, reliability, cost and hardware/software interaction.
• Firmware is software stored in non-volatile memory and designed to control embedded hardware.
Communication Interfaces
• UART is asynchronous serial communication using TX/RX.
• I2C is a two-wire synchronous bus using SDA and SCL; it supports addressed devices.
• SPI is synchronous and commonly uses SCLK, MOSI, MISO and chip select.
• CAN is robust and widely used in automotive and industrial systems.
• I2C is generally multi-device with addressing; SPI commonly uses separate chip-select lines for slaves.
RTOS Concepts
• RTOS means Real-Time Operating System. It is designed to provide predictable timing behavior for tasks.
• A task/thread is an independently schedulable unit of execution.
• Preemptive scheduling allows a higher-priority ready task to interrupt a lower-priority running task.
• Priority inversion occurs when a high-priority task waits indirectly for a resource held by a low-priority task.
• Mutexes, semaphores, queues and event flags are common RTOS synchronization/communication mechanisms.
Scheduling
• Rate-monotonic scheduling assigns higher priority to tasks with shorter periods.
• Round-robin scheduling gives runnable tasks time slices, often among tasks of the same priority.
• Context switching saves the current task context and restores another task's context.
• Deadline is the latest acceptable completion time for a real-time job.
Synchronization & IPC
• Binary semaphore is useful for signaling. Counting semaphore represents multiple available units/events.
• Mutex provides mutual exclusion and typically has ownership semantics.
• Message queues allow tasks to exchange discrete messages safely.
• Critical sections temporarily prevent interruption/preemption to protect very short sensitive operations.
Raspberry Pi & Embedded Linux
• Raspberry Pi is a single-board computer commonly used with Linux and GPIO interfaces.
• GPIO pins can interface with LEDs, buttons and sensors, subject to voltage/current limits.
• Python is commonly used for Raspberry Pi prototyping; C/C++ are also widely used.
• Unlike a typical bare-metal MCU, a Linux-based Raspberry Pi runs a full operating system with processes and drivers.