Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recvbuf needs to be aligned #13

Open
studiohsoftware opened this issue Dec 3, 2020 · 2 comments
Open

Recvbuf needs to be aligned #13

studiohsoftware opened this issue Dec 3, 2020 · 2 comments

Comments

@studiohsoftware
Copy link

studiohsoftware commented Dec 3, 2020

Hi the datasheet for the SAMD21 here https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Atmel-42181-SAM-D21_Datasheet.pdf page 836, says that the ADDR value must be aligned with the two least significant bits zero.

So in USBH_MIDI_dump.ino the bufMidi declaration should be
uint8_t bufMidi[64] __attribute__ ((aligned (4)));

Similarly, looking at USB_MIDI_converter_multi.ino, this leads to the declaration in usbh_midi.h
uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE];
This also needs to be aligned per the datasheet.

I am not sure the implications of this. I am doing a deep dive on this code to sort out the dropped MIDI message problem, and just stumbled on it.

@todbot
Copy link

todbot commented Dec 6, 2020

I was really hopeful your hypothesis that the alignment ofbufMidi and recvBuf would address the message loss I'm seeing (described in #8). But I dusted off my test setup and tried it out: nope. Still seeing missing MIDI messages.
But this is the kind of issue I'm suspecting is the problem.

@studiohsoftware
Copy link
Author

studiohsoftware commented Dec 6, 2020 via email

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

No branches or pull requests

2 participants