bulk-in streaming #2850
Unanswered
cleverca22
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ive been working on drivers for the lan9514 family of ethernet controllers (found in the pi1-pi3, and other places)
for the RX path, it has 2 modes, SEF and MEF
in SEF mode, it sends an ethernet frame as a single bulk-in transfer (max packet size 512), and terminates it with a packet <512 bytes (and 0 bytes if needed), as is usual for usb
in MEF mode, it will concat all of the ethernet frames together(in both modes, there is a 32bit header, telling you the total frame size), and just keep sending more usb packets
and it has a special trick, to delay the "final" usb packet a configurable amount, in the hope that an ethernet frame arrives in time, and it can keep a stream of 512 byte usb packets going
MEF mode will reduce the usb overhead, by ensuring that packets are always transfered at the max size
but tinyusb wont signal bulk-in completion, until you hit the requested size, or a <512 byte packet
too large of a buffer, and you waste ram and have high latency because the application isnt aware of the 1st packet until the entire transfer is done
too small of a buffer and you interrupt the flow when transfers complete
and i feel like asking tinyusb for a single 512 byte transfer would break, because the HCD is expecting a ZLP to terminate it
to properly support that, you would need a way to pass each 512 byte usb packet from the HCD, thru tinyusb, to the application layer, as they arrive, and just keep streaming that as long as buffer space is available
i'm also not sure how other usb controllers would handle this situation? but i believe the dwc2 can be configured to just not expect the ZLP
Beta Was this translation helpful? Give feedback.
All reactions