laforge submitted this change.

View Change

Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
firmware: usb: call USBD_HAL_DISCONNECT while usb init to recover from resets

The firmware doesn't recover from a OSMO_ASSERT() which direct reset the board.
After the reset the firmware will waits forever for the USBD state USBD_STATE_CONFIGURED.
By adding the explicit USBD_HAL_DISCONNECT the board always recovers.

Fixes: OS#5478
Related: SYS#5752
Change-Id: I600a26025166d20b6b27c191f24e4023efdaadf6
---
M firmware/libcommon/source/usb.c
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/firmware/libcommon/source/usb.c b/firmware/libcommon/source/usb.c
index 7a99b15..25b35cf 100644
--- a/firmware/libcommon/source/usb.c
+++ b/firmware/libcommon/source/usb.c
@@ -689,6 +689,7 @@
{
unsigned int i;
/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
+ USBD_HAL_Disconnect();
USBD_HAL_Suspend();
mdelay(500);
USBD_HAL_Activate();

To view, visit change 27406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I600a26025166d20b6b27c191f24e4023efdaadf6
Gerrit-Change-Number: 27406
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>
Gerrit-Reviewer: Hoernchen <ewild@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon@sysmocom.de>
Gerrit-MessageType: merged