mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
DFU: increase USB reset duration to 50 ms
the specification requires a reset duration of at least 10 ms. reset is indicated by the device to the host by removing the pull-up on D+ (host to device reset is a USB packet). we used 20 ms, but on some setups (USB host, stack, hub, and load dependent), this does not seem to be enough (no USB enumeration was performed afterward, at least for the DFU bootloader). increasing to 50 ms solved the issue on the affected setups. instead of USB suspend, the more proper USB disconnect is used. this mainly disables the pull-up provided by the USB peripheral. USB activate is not required since the follow up initialisation takes care of it. Change-Id: If5ceb3b8f7a8f134d4439fdd138dd12b46589f97
This commit is contained in:
@@ -300,17 +300,16 @@ extern int main(void)
|
||||
|
||||
TRACE_INFO("USB init...\n\r");
|
||||
/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
|
||||
USBD_Disconnect();
|
||||
#ifdef PIN_USB_PULLUP
|
||||
const Pin usb_dp_pullup = PIN_USB_PULLUP;
|
||||
PIO_Configure(&usb_dp_pullup, 1);
|
||||
PIO_Set(&usb_dp_pullup);
|
||||
#endif
|
||||
USBD_HAL_Suspend();
|
||||
mdelay(20);
|
||||
mdelay(50);
|
||||
#ifdef PIN_USB_PULLUP
|
||||
PIO_Clear(&usb_dp_pullup);
|
||||
#endif
|
||||
USBD_HAL_Activate();
|
||||
|
||||
USBDFU_Initialize(&dfu_descriptors);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user