Skip to content

Fix UMP output integrity in the ATmega32U4 Arduino example#2

Merged
sauloverissimo merged 3 commits into
mainfrom
fix/atmega32u4-arduino-ump
Jul 14, 2026
Merged

Fix UMP output integrity in the ATmega32U4 Arduino example#2
sauloverissimo merged 3 commits into
mainfrom
fix/atmega32u4-arduino-ump

Conversation

@sauloverissimo

Copy link
Copy Markdown
Owner

Follow-up to #1. Two issues came up in review of the example, both fixed here and both contained to the example (the midi2 core is untouched).

MIDI-CI Discovery replies are SysEx7 UMP packets, and the responder was queueing them one word at a time. If the TX ring had a single free slot when a reply was generated, the first word went in and the second was dropped, leaving half a packet at the head of the ring and corrupting later USB output. The reply now goes through the atomic whole-message write path, so a packet is either queued completely or not at all.

The other one is inbound Data128. The UMP processor consumes MT 0x5 (SysEx8 and Mixed Data Set) for reassembly before the callback runs, and reassembly is off in this example, so those messages were silently dropped instead of echoed. That contradicted the advertised Data128 surface and the echo behavior. Inbound Data128 is now echoed straight back, packet for packet.

The device behaves identically on the normal path and builds at the same footprint.

Queue MIDI-CI SysEx7 replies atomically instead of word by word, so a
full TX ring cannot leave half a packet at the head and corrupt USB
output. Echo inbound Data128 (SysEx8 / MDS) directly, since the processor
consumes MT 0x5 before the UMP callback.
@sauloverissimo

Copy link
Copy Markdown
Owner Author

Two follow-ups from review: message type accessors instead of raw shifts, and the responder replies now pump the transport and retry while the TX ring is full instead of dropping. Revalidated on hardware: Discovery Reply and SysEx8 echo both confirmed on the wire.

@sauloverissimo
sauloverissimo merged commit 005f880 into main Jul 14, 2026
18 checks passed
@sauloverissimo
sauloverissimo deleted the fix/atmega32u4-arduino-ump branch July 14, 2026 17:04
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