Static Analysis for Embedded C: MISRA, PC-lint, and Clang Static Analyzer
MISRA C 2012 rules catch real bugs but require a paid checker. PC-lint finds different things than Clang's static analyzer. A layered approach for a safety-adjacent product.
Microcontroller programming, real-time systems, IoT development, and firmware engineering
Wireshark's USB capture and usbmon reveal descriptor negotiation failures that lsusb hides. A systematic approach to USB enumeration failures on Linux.
MISRA C 2012 rules catch real bugs but require a paid checker. PC-lint finds different things than Clang's static analyzer. A layered approach for a safety-adjacent product.
Unity is a minimal C test framework that runs on target and host. The hard part is not the framework — it's designing seams in firmware code that was never meant to be tested.
The 12-bit ADC on an STM32 rarely achieves 12 ENOB in practice. The gap between datasheet and bench is explained by supply noise, layout, and the reference — and fixable.
Clock polarity and phase mismatches are boring until your sensor returns all-zeros at midnight during bring-up. A systematic approach to sorting it out fast.
Writing to the same flash page on every sensor sample will kill the MCU before the product's warranty expires. Wear leveling strategies for internal flash.
Edge, pulse-width, serial decode, runt — a practical reference for the triggers I actually use when debugging firmware on real hardware.
A complementary filter fuses accelerometer and gyroscope data in ten lines of code. No matrix operations, no Kalman filter. The accuracy trade-off and when it is good enough.
NOR flash supports random read access and XIP. NAND is cheaper per bit but requires a bad-block manager. QSPI interface adds throughput at the cost of more pins.
A product that runs for months will fragment its heap in ways that 24-hour QA testing never reveals. Static allocation, pool allocators, and when to give up on dynamic memory.
Thermal systems have large time constants and pure dead time that make Ziegler-Nichols overshoot badly. What actually worked and how I validated it without an industrial process tool.
Most UART tutorials show 115200 baud where framing errors are rare. At 4 Mbaud the 3% tolerance in the spec becomes a real engineering constraint.