Sorry all, this already solved in Post : Cannot upload to STM32 Bluepill board over STLink-V2 As a workaround by Manuelni, we need to modify for clone Chinese Bluepill module the configuration file under :
you can edit the file ~/.platformio/packages/tool-openocd/scripts/target/stm32f1x.cfg and change the line:
So, after that I try with very basic program one (Blink) Build & Upload work fine (no message, warning or fail) but the on board Led does not blink as expected !
I try to add this in platformio.ini :
upload_protocol = stlink
build_flags = -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
Sorry maxgerhardt, when I mean basic it’s this one : #define LED_BUILTIN PC13 // La LED de la carte est en PC13.
// Fonction de Setup
// Initialise la LED de la carte en Sortie.
// La boucle sans fin …
digitalWrite(LED_BUILTIN, HIGH); // LED ON
delay(100); // Attendre xxx ms
digitalWrite(LED_BUILTIN, LOW); // LED OFF
delay(100); // Attendre xxx ms
I have just personally verified that this firmware runs perfectly fine on my bluepill board and stlink with the code and platformio.ini you have given me. Have you tried pressing the reset button? Have you set the BOOT0 and BOOT1 jumpers to 00 so that the MCU boots the program in flash and not the bootlaoder?
Thanks a lot maxgerhardt, I try first this code with the Arduino IDE, of course to upload the program I move the jumper to programming mode. Without not moving back the jumper to Operating mode the Led is blinking.
So, I move back to platformio and to see the Led blinking I need (instead of Arduino IDE) to move the jumper after upload & push the Reset button to get Led blinking.
That’s probably due to a Soft-Reset or any bad setup on platformio ?
Does the Arduino IDE also upload via STLink or the USB DFU bootloader? Because you only need to set it into “programming” mode for the USB (/UART) bootloading mode. Boot0 = 1 will start this bootloader on reset, Boot0 = 0 will boot the normal user firmware from flash.
Since you’re using the STLink upload with PlatformIO, you don’t need the chip to enter this bootloader mode, since it does a reset via the SWD programming interface. So I’d just leave it there on 00 and upload / program as normal. Then, also no explicit reset press should be needed, because it again resets the chip via the SWD commands.
Ok, back to platformio, I put jumpers to (00) and now that’s working !
I change the time and after Upload the ST-Link Led is blinking and the BluePill Led blink at the new time I program. Without Reset and moving jumper.
Not sure to understand, but the fact is that’s works now.
Thanks a lot for your support !!!
Now time to sleep for me … Tomorrow I will try the debug breakpoints on code with VSCode and PlatformIO.
You should not need to manually setup the file. When you have exported the project for VSCode (pio init --ide=vscode), or have created the project directly with it through the plugin, it is autogenerated. For example
Hello, there is probably something missing, in the project I am creating under platformIO, there is a .pio directory but I do not see the rest (pio init --ide = vscode), how should I proceed? Thank you. Vincent.