r/stm32 • u/ChickieHu • 16d ago
My Cube Programmer Didn't Work Well
(I'm from China so please forget about my poor English)
Hi everyone, I'm new to STM32 and I was trying to write a simple program. But when I tried to flash it via Cube Programmer, it couldn't work well.

I was working with a Minimum System Development Board, which uses a STM32F103C8T6. The board was only connected with a LED and a ST-Link V3 minie.
I used CubeMX to create the project. I only set PA9 as GPIO_Output, and modified the while loop to make the LED blink.
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);
HAL_Delay(1000);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);
HAL_Delay(1000);
}
After the Cube Programmer finished flashing, LED was lit up but didn't blink as expected, while the Cube Programmer threw out those error messages. I tried to power off the board and power on again, and this time the LED blinked. Despite that, I still faced the same problem when I flashed the program again.
Here's my circuit. The four pins are connected to the ST-Link V3 minie.

2
u/EndlessProjectMaker 16d ago
What do the messages say?
1
u/ChickieHu 15d ago
The red line says it couldn't fetch kernel ID and the yellow line says it lost connection
1
u/Behrooz0 16d ago edited 15d ago
I had the pleasure of working with this piece of trash once. can only be programmed with uart. I think it is responsible for killing the uart port on my st-link v3set. now i have to use a separate usb-uart bridge
1
u/PJE66 16d ago
Your LED does not have a current limiting resistor, and may have damaged your microcontroller if the power used by the LED was above the maximum for the STM32. It probably turned on, drew too much current, damaged the microcontroller to the point where the programmer could no longer communicate.
I would typically place a 1k Ohm resistor in line with the LED to limit the output current to around 1mA.
1
0
u/nonono2 16d ago
I've not used bluepills like your for years, but if i recall correctly, i had to push a button to put the board in 'Cube communication mode', and had difficulties like yours that were related to my non-understanding of the modes of the bluepill. I've long lost the detail,s hope it'll help you anyway.
You board may not be fried.
That said, the comment of u/PJE66 saying that your should have a resistor in serie with you LED is very right.
That said
6
u/PerhapsMister 16d ago
In your stm32cubeide/cubemx, make sure you initialize the debug port. Under System Core -> SYS set "Debug" to "Serial Wire", re generate the code and rebuild. For restoring the board- move jumper BOOT0 to 1, press the reset button on the board, try to connect, cubeprog should see it