Skip to content

AMYBOARD: revert MIDI RX buffer 2048 → 512 (fix boot-loop)#877

Merged
bwhitman merged 1 commit intomainfrom
claude/amyboard-rxsize-hotfix
Apr 15, 2026
Merged

AMYBOARD: revert MIDI RX buffer 2048 → 512 (fix boot-loop)#877
bwhitman merged 1 commit intomainfrom
claude/amyboard-rxsize-hotfix

Conversation

@bwhitman
Copy link
Copy Markdown
Collaborator

Summary

v-apr-2026 AMYBOARD binaries boot-loop with a StoreProhibited panic deep inside ESP-IDF's esp_clk_init() / wdt_hal_write_protect_disable call chain — before any tulipcc/amy code runs. Bisect isolates commit 684a04b ("Increase USB MIDI RX buffer to 2048 bytes") as the cause. Reverting just CFG_TUD_MIDI_RX_BUFSIZE from 2048 back to 512 (the pre-684a04bd value) restores a clean boot on the same hardware.

The v-mar-2026 binary was already confirmed to boot fine on the same board, so it's not a hardware regression.

Status

  • Local rebuild with RX_BUFSIZE=512: ✅ builds clean, boots on hardware
  • v-apr-2026 release binaries (amyboard-full-AMYBOARD.bin, amyboard-firmware-AMYBOARD.bin) have already been overwritten with the fixed build so users can flash right now without waiting for this PR to merge

Root cause still unknown

_midid_itf lives in plain .dram0.bss (not a DMA/RTC/exotic section), BSS+heap at 2048 still fits in DRAM by hundreds of KB, and esp_clk_init doesn't touch _midid_itf or USB state. Theories not confirmed:

  • Linker symbol reshuffle moving something important into reserved RAM
  • tu_fifo_t internal limit hit at 2048
  • Early-init stack interaction

Leaving a follow-up issue on the backlog — 512 is empirically safe and matches the pre-bump behavior that worked for months.

Test plan

  • Local build succeeds (idf.py -DMICROPY_BOARD=AMYBOARD build)
  • Flashed amyboard-full-AMYBOARD.bin on physical AMYboard via web flasher, boots cleanly
  • Smoke-test heavy sysex transfers — if RX_BUFSIZE=512 introduces corruption under heavy load again (commit b86b27c rationale), we'll need a proper root-cause fix for the 2048 crash instead of bumping further

🤖 Generated with Claude Code

Commit 684a04b bumped CFG_TUD_MIDI_RX_BUFSIZE from 512 to 2048 to hold
more SysEx chunks for heavy transfer pacing. The resulting v-apr-2026
binary boot-looped on AMYboard hardware with a StoreProhibited panic
deep inside ESP-IDF's esp_clk_init() / wdt_hal_write_protect_disable
call chain — i.e. BEFORE any tulipcc/amy code runs. The same hardware
boots v-mar-2026's image without issue, and rebuilding the apr source
with RX_BUFSIZE back at 512 also boots cleanly, so the 2048 value is
the proximate cause.

Root cause is still unexplained: _midid_itf lives in regular .dram0.bss
(not an exotic section), the BSS/heap layout at 2048 still fits in DRAM
by a wide margin, and esp_clk_init doesn't touch _midid_itf or any USB
state. Theories not yet confirmed: alignment/linker reshuffle moving a
symbol into reserved RAM, the TinyUSB FIFO struct hitting an internal
limit, or a stack-frame interaction during early init. Filing a
follow-up is on the todo list — 512 is empirically safe and matches
the pre-commit-684a04bd behavior that worked for months.

Per commit 684a04b's rationale: 512 holds ~1.5 sysex chunks of slack.
If sysex reliability regresses on slow sketches again we'll need to
find a root-cause fix for the 2048 crash rather than just raising the
buffer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bwhitman bwhitman merged commit 06dddcc into main Apr 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant