USB queued receive

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
iggarpe
Posts: 129
Joined: Sun Sep 30, 2012 8:32 pm

USB queued receive

Postby iggarpe » Sat Oct 31, 2015 5:59 pm

I'm using usbPrepareQueuedReceiveI to receive isochronous OUT data. Let's say that for some reason the data consume stalls, it means the queue will become full.

Since usb_packet_read_to_queue doesn't check for enough space in the queue, I do check myself before calling usbPrepareQueuedReceiveI, the question is what do I do when there is not enough space. I've tried to call usbStallReceiveI to no avail, data keeps coming in and the USB driver keeps pumping that data into the queue.

Question: how do I keep the driver from accepting more data from the host? because as of now, for every received packet the driver will either call usb_read_packet_to_queue or usb_read_packet_to_buffer. Maybe there should be a third choice to just drop the data.

User avatar
Giovanni
Site Admin
Posts: 14462
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1078 times
Been thanked: 922 times
Contact:

Re: USB queued receive

Postby Giovanni » Sat Oct 31, 2015 6:32 pm

The Isochronous code has been contributed only recently, it is likely to be not perfect yet, probably the best thing to do is to check for space availability before putting data in the queue and discard the packet if there is not enough room (the whole packet).

Giovanni


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests