AnsweredAssumed Answered

Porting USB example project to specific MCU

Question asked by Václav on Jul 28, 2014
Latest reply on Jul 30, 2014 by Václav
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 board

The new targetMCU: STM32F102xB

Both 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.

Outcomes