Problem programming Bluepill from Cube
Hello. Please forgive a 'newbie' question. Whilst I am new to STM32 chips I have been programming MCUs for many years which makes this problem even more frustrating.
I wrote a program which I then uploaded onto a Bluepill (genuine processor) using CubeIDE v1.16.0 (and later Cube Prog v2.17 as a standalone) and the STLink V2 interface with the most up to date firmware. The program didn't run so I assumed that it was something that I was doing wrong (it probably still is). I went back to basics and viewed several 'tutorials' on YouTube. I then set up a minimal program to flash the onboard LED at PC13. I left all the settings of the IDE as they came when the IDE was installed. I set PC13 as a GPIO output and left all the rest of the GPIO settings as they were. I used HAL_GPIO_WritePin to write directly to the pin with HAL_Delay as the delay mechanism. So four lines of code in total all placed after the /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { construct. The programmed compiled without error and appeared to upload without problem.
Resetting the board did absolutely nothing.. no LED flash or anything. I repeated the exercise by toggling a different GPIO pin and an external LED. Again nothing.
I tried setting the BOOT_0 jumper prior to powering the board and then uploading. Moving the BOOT_0 jumper back and repowering the board.
Again - nothing. I started to think that the board was faulty. I tried a totally different Bluepill board with no success.
I then had a thought. I had read that you could use ArduinoIDE to program these boards. I set up ArduinoIDE and wrote a simple LED flash program and uploaded it to the board using STLink.
To my surprise the program ran with the onboard LED flashing.
To my logic this proves that both the board and STLink are working as they should and the problem is with Cube.
I repeated the process on two other PCs - one running Windows 11 (like the original PC) and the other Ubuntu 24.04. I had exactly the same results in that the programs uploaded via Cube didn't appear to run.
Sorry for the rambling post. Have any of you any suggestions about what I'm doing wrong? Do you need to put the board into BOOT_0 when using STLink since there appears to be conflicting information on the net?
Thanks in anticipation.
Regards Nev
