AnsweredAssumed Answered

USB OTG interferes with ST-Link

Question asked by frenz.john on Dec 19, 2014
Latest reply on Dec 20, 2014 by frenz.john
I have a problem where USB OTG sometimes interferes with the ability to program the MCU though the mini USB port. Basically what happens is that when I try to program the MCU, the software on computer halts. When I press the reset button it starts programming the chip correctly. Also it will be able to program the chip after waiting a few minutes.

The problem seems to arise when I try to force the usb otg to device mode by setting FDMOD bit in OTG_FS_GUSBCFG register. Also the micro USB cable needs to be connected to the computer for this to happen, if I unplug either end of the cable this doesn't happen. Also commenting out the initialization of pins (8, 9, 11, 12 on GPIO A) helps somewhat, but still programming doesn't succeed within a few first seconds after reset.

I'm using STM32F4Discovery board. For programming I use openocd and I compile with GCC. Also I am _not_ using any USB stack but trying to write my own.