Page 1 of 1

Disable system reset on USB connect/disconnect

Posted: Thu May 25, 2023 4:28 am
by mcu8484
Does anyone know how to disable automatic system reset on USB CDC connect/disconnect in stm32duino?

Thanks

Re: Disable system reset on USB connect/disconnect

Posted: Thu May 25, 2023 9:20 am
by GonzoG
There is no such thing. STMs do not need to reset on USB connect like AVR Arduino boards.
If your board resets then it's rather hardware related.

Re: Disable system reset on USB connect/disconnect

Posted: Fri May 26, 2023 4:11 pm
by mcu8484
There is no HW triggering reset. The issue appears to be the stm32duino USB CDC driver which takes a long time (>1s) in its ISR when the USB host connects/disconnects leading to watchdog timeout reset. Disabling the watchdog is not an option.

Re: Disable system reset on USB connect/disconnect

Posted: Sat May 27, 2023 5:36 am
by ag123
use a longer timeout for watchdog reset?

Re: Disable system reset on USB connect/disconnect

Posted: Fri Jun 02, 2023 9:42 am
by jacobli
Do you want to directly disable automatic reset?

Re: Disable system reset on USB connect/disconnect

Posted: Fri Jun 02, 2023 8:16 pm
by mcu8484
jacobli wrote: Fri Jun 02, 2023 9:42 am Do you want to directly disable automatic reset?
Yes but I need to keep the watchdog active and not longer than 1s. I am guessing that the stm32duino USB CDC driver is doing some handshaking with the host when USB connect/disconnect but taking too long and triggers the watchdog reset.

It would be helpful if someone who knows the stm32duino USB CDC driver internals can point out a potential solution (e.g. where to insert watchdog reset call, etc.).