2020-05-13 07:28 PM
I'm using System Workbench, generated project from CUBEMX.
When I try to compile the code and flash the controller, I must manually disconnect the USB cable from the STM32 controller then plug back after the controller has started running to get functionality on a terminal program.
I was reading the reference manual and some online forums, the OTG_FS_DCTL register has to be set then reset at the SDIS bit to force soft disconnect. However, I couldn't find any references to the declaration of that said register within System Workbench.
Even though Windows needs to re-enumerate connected devices, can't the controller just force the port to be disconnected then reconnected after some delay? If yes, how can I manipulated this through system workbench?
Thanks
2020-05-13 08:55 PM
You can deinitialize the USB peripheral for a bit, then reinitialize it to force a re-enumeration. There is probably an easier way, maybe the DCTL register you mentioned.
OTG_FS_DCTL is "USB->DCTL" in the stm32f10xxx.h include file.