2014-07-28 07:12 AM
Hello,
I'd like to use an USB example project on a different (but very similar) microcontroller on a custom board.The example project: STM32 USB FS Device Library V4.0.0 --> VirtualComport_Loopback project --> STM3210B-EVAL boardThe new targetMCU: STM32F102xBBoth are STM32F10x so there shouldn't be a big difference about the usb peripheral, maybe only the pinout I think?What I did so far: modified project target MCU (STM32F10X_MD), defined desired clock frequency(there is an external 4MHz crystal, system clock is set to 24MHz, and USB gets 48MHz independently), cleaned the eval board specific LED and button functions because my board is different, in platform_config.h I set USB_DISCONNECT, USB_DISCONNECT_PIN, and RCC_APB2Periph_GPIO_DISCONNECT defines to match the port/pin of USB_DP pin of the MCU, I aslo have external 1.5k pullup resistor on USB_DP so I've uncommented #define USB_USE_EXTERNAL_PULLUP.So far it doesn't work, when I plug in the usb nothing happens on Windows (no new device). Also when I program the chip, the debugger disconnects after some time (2 seconds) and I can't connect the chip again, I can only reflash using the ST-Link utility.So what else do I have to change to get it working?Thank you for your help.2014-07-30 07:01 AM
What software problem can cause that the debugger disconnects shorty after the code begins to run? Then I can reflash the MCU only with the ST-Link -> Connect Under Reset option.
Is it caused by reconfiguring the JTAG pins (input/output)? Or can it be caused by sleep or USB suspend state?2014-07-30 07:19 AM
Yes, the ST-LINK would be particularly prone to dumping the connection if the CPU is put in a low power mode (WFI, SLEEP, STOP, etc)
You might be able to alter this via a DBGMCU register controlling the behaviour when the debugger is attached.2014-07-30 01:08 PM
Thank you, yes that was the case. I've set DBGMCU and now the debugger doesn't disconnect.
I still have the original problem that the ported code doesn't work on this microcontroller. What could I have forgot to change? When I plug in the USB cable, nothing happens.