-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fix Tx FIFO memory calculation #26
Conversation
This used to allocate 9 * 16 words minimum, no matter how many tx endpoints where active. Now we only account for memory allocated to enabled Tx endpoints when determining how much has already been used.
No, this loop doesn't allocate anything, actual allocation happens below. In fact, initialization value should be
|
It may not allocate anything, but it calculates the used memory incorrectly, which results in throwing a |
RM0390, if I recall correctly (I'll look it up in a bit), says that only applies for active endpoints. |
If this is true (I also think so, but I was unable to find any evidence in RMs), then I'd suggest changing it to something like used += self.tx_fifo_size_words.iter().sum(); |
The best quote I can glean from the RM is
which seems to imply that it's only for active endpoints. Practically speaking, my application (an implementation of USB Audio Class 2.0) works fine with this change. It's got two endpoints, one large OUT endpoint for audio data and one 3-byte IN ep for the audio feedback channel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes an issue with FIFO allocation limits; see stm32-rs/synopsys-usb-otg#26
Fixes an issue with FIFO allocation limits; see stm32-rs/synopsys-usb-otg#26
535: Bump synopsys-usb-otg to 0.3.1 r=burrbull a=dgoodlad Fixes an issue with FIFO allocation limits. tl;dr the previous version assumed that 16 32-bit words were allocated for every _possible_ TX endpoint, when only active endpoints should be considered. See stm32-rs/synopsys-usb-otg#26 Co-authored-by: David Goodlad <david@goodlad.net>
This used to allocate 8 * 16 words minimum, no matter how many Tx endpoints where active. This was because
tx_fifo_size_words
is set to[0; 9]
innew
. Now we only account for memory allocated to enabled Tx endpoints when determining how much has already been used by limiting the elements we consider to those before the current endpoint being allocated.