Microcontroller peripherals are functional blocks integrated into the chip that enable it to interact with the outside world or carry out specific tasks β often without involving the processor core.
π When selecting a microcontroller, your choice should depend on the required peripherals, not the other way around.
The peripherals of a microcontroller act like its senses, enabling it to interact with the outside world, process analog signals, manage time, communicate with other devices, and perform various application-specific tasks.
Each microcontroller includes a different set of peripheral modules, depends on its architecture, manufacturer, specific model etc, and which determine its capabilities and cost.
Typical peripherals include:
* ADC (Analog-to-Digital Converter)
* Timers and PWM Generators
* Analog Comparators
* Communication interfaces such as UART (serial port), SPI, I2C, USB, and CAN
Most microcontrollers, regardless of brand or architecture, include a core set of these essential peripherals.
{{ img(src = "/images/emb/mcu_peripherals.png") }}
| Category | How it can be different | MCU examples |
|---|---|---|
| GPIO | Number of pins, alt-functions, open-drain/push-pull, switching speed, pull-up resistors. |
STM32F103 β basic set, alt-functions via AFIOESP32S3 β up to 45 pins, flexible routing via GPIO matrixRP2040 β 30 GPIO, PIO support
|
| TIMER / PWM | Bit depth (8/16/32 bit), number of timers, modes (OneShot, PWM, Capture), channels, dead-time. |
STM32H7 β advanced timers with dead-time, synchronizationRP2040 β 8 PWM blocks with independent channelsATmega328P β 3 timers (2Γ8 bit, 1Γ16 bit)
|
| UART / USART | Number of ports, DMA support, auto-detection of speed, support for IrDA, LIN, RS-485. |
STM32F4 β up to 6 USARTs, IrDA and SmartCard supportESP32 β 3 UARTs, all with DMARP2040 β 2 UARTs, software implementation via PIO
|
| SPI / I2C | Number of modules, speed (up to 80+ MHz), master/slave modes, DMA support, multi-master. |
STM32L4 β SPI with CRC and NSS supportESP32S3 β up to 4 SPI/I2C, with DMA and master/slave modesAVR ATmega328P β I2C (TWI) and SPI with basic functionality
|
| ADC / DAC | Bit depth (8-16 bit), number of channels, speed, built-in buffers, calibration. |
STM32G4 β 16-bit ADC, 2 MSPSESP32 β 12-bit ADC (low quality), 2 DACRP2040 β 12-bit ADC, no DAC
|
| DMA | Number of channels, peripheral support, linked list, circular mode, prio levels. |
STM32F4 β up to 16 DMA channels, peripherals + memoryRP2040 β 12 channels, programmable transfersESP32 β built-in DMA controller with SPI/UART
|
| USB | Support for host/device/OTG mode, protocols (CDC, HID, MSC), built-in or external PHY. |
STM32F103 β USB FS deviceSTM32H7 β HS + FS, OTGESP32S3 β USB OTG (host + device)
|
| Wi-Fi / BLE | Version support (BLE 4.2/5.0), co-existence, built-in stack or external module. |
ESP32S3 β Wi-Fi 2.4 GHz, BLE 5.0nRF52840 β BLE 5.3, Thread/ZigbeeSTM32WB β STM32 + BLE on a single chip
|
| RTC / WDT / Power | External quartz support, wakeup from sleep, low power, independence from system clock. |
STM32L4 β RTC + deep sleepESP32 β ULP core, wake-on-touchAVR β the simplest WDT, deep sleep with interrupts
|
| Specialized | PIO, machine vision, crypto modules, LED drivers, graphic accelerators, LCD controllers. |
RP2040 β 2 PIO blocksESP32S3 β AI acceleration + LCD controllerSTM32H7 β ChromART GPU, JPEG decoder
|
π‘ Usage examples
| Device | Peripherals involved |
|---|---|
| Smart lamp | GPIO, PWM, UART (for BLE), ADC (for light sensor) |
| Weather station | I2C (sensors), ADC (analog sensors), UART (screen), RTC |
| Robot on wheels | PWM (motors), UART (Bluetooth), SPI (IMU), GPIO |
| Oscilloscope on MCU | ADC, DMA, SPI display, USB |
π Tips for working with peripherals
- Use HAL libraries or register access depending on the task.
- Always initialize peripherals correctly: setting up pins, frequencies, interrupts.
- Handle errors: buffer overflows, loss of synchronization, etc.
- Use the datasheet of the microcontroller - everything is described there in detail.