
Esp32 Debugging
- 244 installs
- 6 repo stars
- Updated July 31, 2026
- laurigates/mcu-tinkering-lab
Diagnose ESP32 firmware crashes, peripheral faults, and serial/log anomalies when IoT prototypes misbehave in lab benches or field pilots.
About
esp32-debugging from mcu-tinkering-lab guides agents through ESP32 fault isolation: interpret serial panics, use OpenOCD or GDB, trace peripheral issues, and bisect firmware changes until stable embedded behavior returns.
- Serial and JTAG debug flows
- Watchdog and panic triage
- Peripheral fault isolation
- Firmware bisect guidance
- Memory and stack analysis
Esp32 Debugging by the numbers
- 244 all-time installs (skills.sh)
- +6 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #152 of 596 Debugging skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/laurigates/mcu-tinkering-lab --skill esp32-debuggingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 244 |
|---|---|
| repo stars | ★ 6 |
| Last updated | July 31, 2026 |
| Repository | laurigates/mcu-tinkering-lab ↗ |
What it does
Diagnose ESP32 firmware crashes, peripheral faults, and serial/log anomalies when IoT prototypes misbehave in lab benches or field pilots.
Files
ESP32 Firmware Debugging Guide
When to Use This Skill
Apply this skill when the user:
- Encounters compilation errors in ESP-IDF projects
- Sees runtime panics or "Guru Meditation Error" messages
- Has memory-related crashes or stack overflows
- Experiences I2C/SPI/UART communication failures
- Needs help interpreting serial monitor output
$ARGUMENTS may contain error messages or context about the issue.
Debugging Process
Ask for Context First
If the error isn't clear from $ARGUMENTS, ask the user to provide: 1. Full error message or panic output 2. Which project they're building 3. Recent code changes
1. Compilation Error Analysis
Run a fresh build to capture the error:
just <project>::build 2>&1 | tail -100Missing Includes
fatal error: driver/gpio.h: No such file or directoryFix: Add the component to REQUIRES in main/CMakeLists.txt:
idf_component_register(
SRCS "main.c"
REQUIRES driver
)Undefined References
undefined reference to 'some_function'Fix: Ensure the component containing the function is in REQUIRES or PRIV_REQUIRES.
Type Errors Look for mismatched types between function declarations and implementations.
2. Runtime Panic Analysis
Guru Meditation Error Patterns
| Error | Cause | Fix |
|---|---|---|
StoreProhibited | Writing to invalid memory | Check pointer initialization |
LoadProhibited | Reading from invalid memory | Check null pointers |
InstrFetchProhibited | Corrupted function pointer | Check callback assignments |
IntegerDivideByZero | Division by zero | Add zero checks |
Stack Overflow
Guru Meditation Error: Core 0 panic'ed (Stack overflow)Fix: Increase stack size in task creation:
xTaskCreatePinnedToCore(task_fn, "name", 4096, NULL, 5, NULL, 0);
// ^^^^ increase thisStack Smashing
Stack smashing detectedFix: Local buffer overflow — check array bounds and string operations.
3. Memory Debugging
Check Heap Usage
ESP_LOGI(TAG, "Free heap: %lu", esp_get_free_heap_size());
ESP_LOGI(TAG, "Min free heap: %lu", esp_get_minimum_free_heap_size());Common Memory Issues
- Memory leak: Missing
free()aftermalloc() - Double free: Freeing same memory twice
- Use after free: Accessing freed memory
4. Communication Debugging
I2C Issues
E (1234) i2c: i2c_master_cmd_begin(xxx): I2C_NUM errorChecklist:
- Verify I2C address (7-bit vs 8-bit format)
- Check SDA/SCL GPIO pins
- Ensure pull-up resistors are present (4.7K typical)
- Verify clock frequency compatibility
Serial/UART Issues
- Baud rate mismatch
- TX/RX swapped
- Missing ground connection
Dual-Controller Sync (I2C)
- Check both controllers are running
- Verify I2C addresses match
- Check GPIO pin configuration
5. Build Commands for Debugging
# Clean build to eliminate stale objects
just <project>::clean && just <project>::build
# Start serial monitor
just <project>::monitor PORT=/dev/cu.usbserial-00016. Useful ESP-IDF Config Options
Enable in sdkconfig.defaults or via menuconfig:
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT— Print panic info before rebootCONFIG_FREERTOS_WATCHPOINT_END_OF_STACK— Detect stack overflow earlierCONFIG_HEAP_POISONING_COMPREHENSIVE— Detect heap corruption
Common Fixes
| Symptom | Fix |
|---|---|
| Stack overflow | Increase task stack size in xTaskCreate |
| Memory leak | Check for missing free() calls |
| I2C timeout | Verify connections, pull-ups, addresses |
| Crash on startup | Increase CONFIG_ESP_MAIN_TASK_STACK_SIZE to 8192+ |