Actions
Bug #4329
closedIN endpoint gets stuck during USB suspend
Start date:
12/15/2019
Due date:
% Done:
100%
Spec Reference:
Description
Despite all my efforts to fix #4251, I still coulf find situations where the number of alloccated buffers would grow. Even more so, after stopping the simtrace2-remsim-client program for some time and later re-starting it, the pending transfers from before would not get delivered.
It took me many hours of debugging. What appears to happen is the following sequence of events:- the firmware writes the first entry of the IN endpoint transmit queue to the USB device peripheral (UDP) of the SAM3S
- the host is currently not scheduling any IN transfers as the libusb-using application is stopped and hence there are no URBs for that IN endpoint
- the host application is restarted at some point (and obviously sends IN tokens again)
- the pending transfer never completes, which in turn blocks all the further entries of the endpoint transmit queue.
- it actually deactivates the USB transceiver and the peripheral clock to the USB device
- it doesn't call any pending callbacks for the ongoing transfers (not even calling them with state=error)
- it doesn't block any further calls to the USB peripheral, such as USBD_Write() calls that will happily [think they] modify the registers of the USB peripheral
The main problem seems to center around the call to UDP_DisablePeripheralClock()
from USBD_HAL_Suspend()
. If I comment-out that call, IN transfers continue happily after the USB Resume.
Related issues
Updated by laforge over 4 years ago
- Related to Bug #4251: simtrace2 firmware can get OOM / talloc unable to allocate buffer for APDU added
Updated by laforge over 4 years ago
- % Done changed from 30 to 80
Updated by laforge over 4 years ago
- Status changed from In Progress to Resolved
- % Done changed from 80 to 100
patch merged.
Updated by laforge over 4 years ago
- Related to Bug #4335: Unexpected/malformed data from SIM applet causes simtrace2-sniff to stop until simtrace2 board is reset added
Actions