Using Maple Mini(STM32F103CBT6) here. I wanted to make a USB example work however, none of it seemed to work despite configuring the project build optimal for the chip.
I found that the reason behind why this didn’t work is because that the example project had different USB pull-up resistor GPIO pin connections compared to Maple Mini.
What I did is fundamentally the same as here.
I used IAR Embedded Workbench, and downloaded the ST examples from the browser page.
STM32F103CBT6 is a MD(Mid-Density) device, so the project configuration is set to ‘STM3210B-EVAL’ to match this attribute.
In any USB example, go to ‘platform_config.h’. It’s quite irritating to access this header file. In my case, I accessed it by expanding ‘hw_config.c’ like below.
The following are the changes that I made in ‘platform_config.h’:
/* Define the STM32F10x hardware depending on the used evaluation board */ #ifdef USE_STM3210B_EVAL // #define USB_DISCONNECT GPIOD // #define USB_DISCONNECT_PIN GPIO_Pin_9 // #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOD #define USB_DISCONNECT GPIOB #define USB_DISCONNECT_PIN GPIO_Pin_9 #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOB
I have modified the code like above. Commented out the original code and made a slight change as the three lines below it.
If you look at the schematic of Maple Mini,
you can see that the pull-up resistor is eventually controlled by a node named ‘DISC’. Turning our eyes to the actual STM32F103CBT6 chip, we can identify that ‘DISC’ node is connected to PB9 pin.
This is why I changed the USB_DISCONNECT pin configuration to match PB9.
After making this simple change, rebuild, programming to Maple Mini, the Maple Mini is recognized as a usb device from the PC! Of course, it is only recognized and doesn’t work properly but still it is a huge progress from nothing.
Update: 161022
This modifications seems to work in ‘mass storage’ ‘VCP’ ‘VCP_loop’ examples. It doesn’t work in ‘joystick’ ‘custom_HID’ example. I guess there is more to be done in the latter examples…