Microcontroller Firmware and RTOS Engineering

Build and debug MCU firmware with bounded ISR/RTOS timing, safe DMA ownership, and measured power budgets.

by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Build a low-power sensor logger on a microcontroller.”
Beforegeneric AI agent
Building a low-power sensor logger is a classic embedded systems project. You'll need to think about several things: selecting the right microcontroller for your power budget, configuring the sensor interface (I2C or SPI), setting up interrupts or timers for sampling, and implementing some form of storage. Power optimization is key—you'll probably want to use sleep modes, disable unused peripherals, and maybe manage the clock frequency. You'd also want to consider data storage, whether on flash or external memory. If you let me know what sensors you're using, your target battery life, and your storage requirements, I can help you design something more specific.
Afterwith Microcontroller Firmware and RTOS Engineering
LOW-POWER SENSOR LOGGER ARCHITECTURE

MICROCONTROLLER CONFIG
• MCU: STM32L476 (ultra-low-power, 32KB RAM, 256KB flash)
• Clock: 16 MHz HSI (sufficient for sensor read rate)
• Sleep mode: STOP2 (0.9 µA consumption, RTC wakeup active)

PERIPHERAL SETUP
• I2C sensor interface: DMA-driven (no CPU polling)
• Timer interrupt: Every 60 seconds, wakes MCU from STOP2
• UART: Used only for config, disabled during logging (saves 1 mA)
• Unused peripherals: ADC, SPI disabled at startup

DMA TRANSFER PATTERN
1. Timer triggers ADC conversion (DMA writes to sensor register)
2. I2C DMA reads sensor data (interrupt on completion)
3. CPU wakes on interrupt, copies data to ring buffer (SD card write batched)
4. CPU returns to STOP2

POWER PROFILE
• Active (sensor read + write): 12 mA, 50 ms duration
• Sleep (STOP2): 0.9 µA
• Cycle: Read every 60 sec = avg 10 µA (10 mAh per day from 2000 mAh battery = 200 day runtime)

STORAGE
• Ring buffer: 512-byte on-chip (SPI flash fallback if SD card fails)
• Batch write: Every 10 reads (reduces SD card power overhead)
• Format: Binary + CRC per record (faster parse, ~100 bytes per reading)

DEBUG: pprof endpoint logs latency, sleep-wake transitions, battery voltage every log cycle

About this skill

Your firmware works until interrupts overlap, a DMA buffer gets reused, or the board enters sleep. This skill develops and reviews microcontroller firmware by tracing clock configuration, timing deadlines, buffer ownership, and actual current consumption.

What it does

  • Writes or reviews STM32, ESP32, and bare-metal firmware against explicit hardware and SDK assumptions.
  • Finds ISR and FreeRTOS failures involving interrupt priorities, blocking calls, lost events, priority inversion, and stack pressure.
  • Designs DMA transfers with clear buffer ownership, completion signaling, overrun detection, and cache handling where required.
  • Calculates peripheral throughput, buffer deadlines, task response budgets, and timer settings.
  • Builds low-power plans that account for radio behavior, wake sources, board leakage, and energy per operating cycle.
  • Produces targeted firmware changes and bench checks that distinguish a plausible fix from a measured result.

What you get

A focused diagnosis, implementation, or review sized to your request, with explicit assumptions, timing or power calculations, and concrete validation steps. Hardware-dependent code identifies the exact configuration details that still need verification.

Best for

Engineers building or troubleshooting MCU firmware, FreeRTOS applications, interrupt-driven peripherals, DMA data paths, and battery-powered devices.

SKILL.md preview

SKILL.md
---
name: microcontroller-firmware-and-rtos-engineering
description: Develop and debug microcontroller firmware by checking hardware configuration, calculating timing budgets, defining ISR/task/DMA ownership, and designing measured power reductions. Use when the user says "write STM32 firmware", "set up an ESP32 peripheral", "my FreeRTOS task keeps missing deadlines", "my UART keeps dropping bytes", "debug this interrupt handler", "configure circular DMA", "my board drains the battery in sleep", or "review this bare-metal driver".
---

# Microcontroller Firmware and RTOS Engineering

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →