Compare

Embedded Systems — Topic comparisons

7 comparisons · Understand differences between similar concepts.

Bare Metal vs RTOS Programming

A thermostat that reads temperature every second and toggles a relay has no need for FreeRTOS — a 200-line bare-metal loop on a PIC16 does the job with 2 kB flash. A drone flight controller reading IMU at 1 kHz, running a PID loop at 500 Hz, managing telemetry, and handling a failsafe timer simultaneously needs deterministic multitasking — FreeRTOS on an STM32F4 gives exactly that without hand-rolling a scheduler. The question is always whether application complexity justifies the OS overhead.

CAN vs UART

A car's ABS module sends wheel speed to the ECU, while the ECU simultaneously sends brake commands back — all over a single twisted pair CAN bus at 500 kbps with 30 nodes connected. Try that with UART: you would need point-to-point wiring between every pair of nodes, 900 cables in a 30-node system. CAN's multi-master bus with message arbitration was designed for exactly this scenario, and UART was not.

DMA vs Interrupt Data Transfer

Streaming 44.1 kHz stereo audio from an I2S codec to a DAC on an STM32F4 using interrupts fires 88,200 ISRs per second — the CPU spends 30% of its time context-switching into ISRs, saving registers, and returning. Wire the same I2S peripheral to DMA channel 4 and the CPU usage for that transfer drops to zero; the DMA controller moves data between the I2S FIFO and SRAM while the CPU runs the audio DSP algorithm. That is the practical value of DMA, and it matters every time you push data rates above a few thousand transfers per second.

Polling vs Interrupt Driven I/O

An Arduino reading a keypad with a while-loop that checks digitalRead() every millisecond is polling — the CPU wastes cycles even when no key is pressed. A smoke detector MCU that sleeps at 10 µA and wakes in 10 µs the moment a sensor threshold crosses uses an interrupt — the CPU does nothing until the event demands attention. The choice directly sets power consumption, response latency, and how much CPU bandwidth is left for the rest of the application.

Preemptive vs Cooperative RTOS

A FreeRTOS project that blinks an LED and reads UART simultaneously works fine in both preemptive and cooperative mode — until a new developer adds a 50 ms blocking delay inside the UART task. In preemptive mode the LED task preempts automatically and keeps blinking; in cooperative mode the whole system stalls until the blocking call yields. That difference in fault-tolerance-to-developer-mistakes explains why production firmware almost always chooses preemptive scheduling.

SPI vs I2C

You have one free I2C bus and six spare GPIO pins on your STM32. Adding three more sensors is trivial over I2C — they share two wires, each with a 7-bit address. Add one high-speed ADC and the I2C bus is the bottleneck; you route a SPI bus instead and run the ADC at 10 MHz with its own CS line. That GPIO-versus-speed calculus is made dozens of times in every embedded design, and this comparison gives you the numbers to make it correctly.

UART vs USB

Flashing firmware onto a Blue Pill STM32 board with a USB cable and STM32CubeProgrammer takes 10 seconds at 12 Mbps; doing the same over UART with FTDI adapter at 115200 baud takes nearly 3 minutes for the same binary. The protocol stack complexity difference is just as dramatic — UART is 15 lines of register configuration, USB needs a full device stack, descriptor tables, and endpoint management. Knowing when that complexity pays off is the engineering judgment this comparison demands.