Embedded / MCU
Timer, baud-rate, ADC, clock-tree and throughput calculators for firmware bring-up, plus condensed tables for common MCU families, clock sources, GPIO and power modes.
Timer PWM & Overflow
UART Baud Rate & Error
ADC Resolution & Conversion
PLL System Clock
Independent Watchdog Timeout
SPI Data Throughput
I2C Bit-Rate & Frame Time
Sleep Timer & Battery Life
๐ MCU Diagrams
Simplified views of a minimal MCU system, timer PWM timing, the PLL clock tree and GPIO output stages.
Minimal MCU system โ A working MCU needs a decoupled supply, a reset that is pulled high, a clock source (crystal or RC) and access to the debug port (SWD) plus a boot-mode pin.
PWM counter & output โ The timer counts from 0 to ARR; the output goes high until the counter reaches CCR. Adjusting CCR changes only the duty, while ARR sets both the period and the resolution.
PLL clock tree โ The oscillator is divided by M, the PLL multiplies by N to a VCO, and the post-divider P scales it to SYSCLK, which feeds the AHB/APB domains and peripherals.
GPIO output stages โ Push-pull drives the pin high and low through two transistors; open-drain only pulls low and needs an external pull-up, which lets the line rise to whatever rail it is tied to.
I2C address frame โ SCL clocks SDA through a START condition then 7 address bits plus the read/write bit; the addressed slave stretches the clock if it needs more time and acks by pulling SDA low on the next clock.
Power-mode state machine โ The core advances Running โ Sleep โ Stop โ Standby, trading wake latency against draw. Sleep wakes on any interrupt, Stop on EXTI/RTC, Standby only on reset or a wake-up pin โ and loses RAM contents.
Interrupt servicing โ When an event asserts an IRQ, the core finishes the current instruction, saves context and jumps to the ISR after a fixed latency, then returns to the main loop. Keep ISRs short so lower-priority work still meets its deadline.
๐ MCU Reference Tables
Condensed specs for common MCU families, clock sources, GPIO electricals and power modes. Values are typical โ always refer to the part's datasheet.
Common MCU Families
| Part | Core | Flash/RAM | Max clock | Peripherals | Notes |
|---|---|---|---|---|---|
| STM32F103C8 | Cortex-M3 | 64K/20K | 72 MHz | 3×TIM, USART×3, SPI, I2C, ADC | Blue Pill classic; USB, cheap |
| STM32G030 | Cortex-M0+ | 32K/8K | 64 MHz | TIM×6, USART×2, ADC, DAC | Low-cost HSI-only, 32-bit |
| ATmega328P | AVR | 32K/2K | 20 MHz | 3×TIM, UART, SPI, I2C, ADC | Arduino Uno; 5 V native |
| PIC16F877A | 8-bit PIC | 14K/368 | 20 MHz | 3×TIM, USART, MSSP, ADC | Legacy but everywhere; 40-pin |
| MSP430G2553 | 16-bit RISC | 16K/0.5K | 16 MHz | TIM, UART, SPI, I2C, ADC | Ultra-low power, analog |
| nRF52840 | Cortex-M4F | 1M/256K | 64 MHz | BLE, USB, QSPI, NFC, ADC | Radio + lots of RAM |
| ESP32 | Xtensa LX6 | 4M/520K | 240 MHz | Wi-Fi, BT, UART×3, SPI, ADC | Wireless SoC; external flash |
| RP2040 | Cortex-M0+ ×2 | 2M/264K | 133 MHz | PIO, DMA, USB, ADC, I2C/SPI | Pico; programmable IO |
Clock Sources
| Source | Typical freq | Accuracy | Notes |
|---|---|---|---|
| HSI (internal RC) | 8 / 16 MHz | ±1–3 % | Boots instantly; drift with temperature |
| HSE (external) | 4–25 MHz | ±20–100 ppm | Crystal; the source for accurate timing / USB |
| LSI (internal) | 32 / 40 kHz | ±10–30 % | Drives IWDG / low-power auto-wake; coarse |
| LSE (external 32k) | 32.768 kHz | ±20 ppm | Watch crystal; keeps RTC accurate in sleep |
GPIO Electricals (typical)
| Parameter | Typical value | Notes |
|---|---|---|
| Input high VIH | 0.6–0.7 × VDD | Above this reads as logic 1 |
| Input low VIL | 0.3–0.4 × VDD | Below this reads as logic 0 |
| Output push current | 4–20 mA | Do not drive LEDs/relays directly |
| Pull-up / pull-down | 20–50 kΩ | Weak; not for strong loads |
| Max toggle rate | 5–50 MHz | Needs matching output speed config |
| Absolute max V / VDD | VDD ± 0.3–0.5 V | Over-driving pins damages the IO |
Low-Power Modes
| Mode | Wake sources | Typical draw | Notes |
|---|---|---|---|
| Sleep | Any interrupt | μA–mA | CPU halts, clock keeps running |
| Stop | EXTI, RTC, wake-up pin | µ–few µA | Peripherals off, SRAM retained |
| Standby | Reset, wake-up pin, RTC | µA and below | Everything off; RAM lost |