mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
cardem: reset the uC in case of USB disconnect
This fixes the firmware USB interface somehow getting stuck after a USB disconnect/reconnect without power cycle. Right now there are a number of things we only execute the first time we reach USBD_STATE_CONFIGURED, but not at any subsequent such event. It's also rather clear that this doesn't really show in simtrace2 as it is bus-powered. And it doesn't show on OWHW as we don't have any USB unplug situations of the USB between the on-board traces of USB host and SAM3S. So this really only is relevant to QMOD. A cheap and dirty work-around is to simply reset the entire uC every time a USB unplug happens. Change-Id: I6678bb2192c1419ed388b46c4ae7aa1ce18dc7ee Related: OS#5578
This commit is contained in:
@@ -206,6 +206,10 @@ extern int main(void)
|
|||||||
if (isUsbConnected) {
|
if (isUsbConnected) {
|
||||||
isUsbConnected = 0;
|
isUsbConnected = 0;
|
||||||
}
|
}
|
||||||
|
/* HACK: we don't really deal with USB disconnect yet,
|
||||||
|
* so let's just reset the entire uC if this happens */
|
||||||
|
TRACE_INFO("Resetting uC on USB disconnect\n\r");
|
||||||
|
NVIC_SystemReset();
|
||||||
} else if (isUsbConnected == 0) {
|
} else if (isUsbConnected == 0) {
|
||||||
TRACE_INFO("USB is now configured\n\r");
|
TRACE_INFO("USB is now configured\n\r");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user