Hi,
First let me say the driver works perfectly OK.
But when I digging into the code, some part I cannot understand. Here I'm based on ChibiOS 17.6.0, I think the part in 16.1.8 is identical.
When an OUT packet arrives at data EP, here is what happens:
1. The USB lld saves the packet to assigned buffer. When small packet received or buffer full, user callback (sduDataReceived) is called.
2. In sduDataReceived, received buffer is filled in ibqueue. CHN_INPUT_AVAILABLE is fired and waiting thread are waked up *later* to process the queue.
3. sduDataReceived prepares next receiving using sdu_start_receive()
4. sdu_start_receive() will start receiving if: USB state is ACTIVE or READY; USB is not receiving; ibqueue has an empty buffer.
Suppose the thread waiting for ibqueue is not fast enough to empty the queue, sdu_start_receive() will not start receiving, and subsequent USB OUT packet will be NAKed.
My question is: when the OUT endpoint will be armed again once ibqueue becomes empty? I'm not able to locate the code does this.
Thanks
Baoshi
Understanding the OUT EP handling in Serial-over-USB driver
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Understanding the OUT EP handling in Serial-over-USB driver
Hi,
The buffers object has callbacks, OUT transactions are restarted in callbacks.
Giovanni
The buffers object has callbacks, OUT transactions are restarted in callbacks.
Giovanni
Re: Understanding the OUT EP handling in Serial-over-USB driver
Got it. In ibnotify of hal_serial_usb.c
Thanks!
Thanks!
Who is online
Users browsing this forum: No registered users and 30 guests