STM32F103C8T6(Black Pill) arduino upload issue

Hello,

I'm currently trying to develop with the STM32F103C8T6 (Black Pill) using the Arduino IDE.

I followed the setup instructions provided at the URL below, aiming to run the Blink example, but encountered an issue—the upload process fails for reasons unknown.

:play_button: URL : bv3ue radio blog: Black Pill(STM32F103C8T6) to work with Arduino

The test setup I used is shown in the image below.

:play_button: STM32F103C8T6(Black Pill) : STM32F103C8T6 - Black Pill | STM32-base project
:play_button: FT232BL USB to TTL : https://www.amazon.com/Adapter-FT232-Module-Serial-Port/dp/B0DGV8PWYC

After completing all the steps outlined at the provided URL, I attempted to upload the Blink example. However, the Arduino IDE displayed the following message, and I observed no change in the LED on the Black Pill hardware.

Could you please provide guidance on how to resolve this issue?

Thank you.

Hi @paramountain55.

Explanation

I think the cause of the error is explained here:

https://github.com/rogerclarkmelbourne/Arduino_STM32/issues/834#issuecomment-1661152147

The 3rd party "STM32F1xx/GD32F1xx boards" platform from Roger Clark that you are using to add support to Arduino IDE for the "Black Pill" board uses a tool named "maple_loader" to upload sketches to the board. maple_loader is written in the Java programming language, and so to use it you must have the appropriate Java Runtime Environment installed on your computer.

The Arduino IDE 1.x application is written in the Java programming language, and so the installation of that version of Arduino IDE includes a copy of the Java Runtime Environment. Because the "STM32F1xx/GD32F1xx boards" platform was developed during the Arduino IDE 1.x era, the assumption was made that any user of Arduino IDE will have that specific version of the Java Runtime Environment installed, so the developers of the platform didn't bother to make any provisions to supply that dependency of maple_loader.

Arduino IDE 2.x is a complete rewrite of the Arduino IDE application. This application is written in the TypeScript programming language instead of Java so the Arduino IDE 2.x installation does not include a copy of the Java Runtime Environment. This means that when you use the "STM32F1xx/GD32F1xx boards" platform with Arduino IDE 2.x, it attempts to use your global installation of the Java Runtime Environment. The problem with that is the maple_loader tool is written specifically for the version of Java provided by Arduino IDE 1.x. Your global system installation is a different Java version that is not compatible with maple_loader.

Solution

The most simple solution would be to use the actively maintained "STM32 MCU based boards" platform instead of the largely abandoned "STM32F1xx/GD32F1xx boards" platform you are using now.

You can learn how to install the STM32 MCU based boards" platform from that project's documentation:

https://github.com/stm32duino/Arduino_Core_STM32?tab=readme-ov-file#getting-started

Alternative solution

In case you have a specific reason for using the Roger Clark "STM32F1xx/GD32F1xx boards" platform, the alternative simple solution would be to use Arduino IDE 1.8.19 instead of 2.x. The download links for Arduino IDE 1.8.19 are listed here:

https://www.arduino.cc/en/software#legacy-ide-18x

Installations of Arduino IDE 1.8.19 and 2.x can coexist on your computer without any problems so if you want to continue to use Arduino IDE 2.x for other boards then you are welcome to leave it installed and switch back and forth between the two different IDE versions as you like.

I think you use a wrong CPU Clock settings:

The standard CPU Frequency for STM32F103 core is 72 MHz. The bootloader you loaded onto the board is compiled for use at 72MHz and simply won't work at any other frequency.

Thank you for your kind response.

Based on your guidance, I installed the STM32 MCU based boards platform from the following

:play_button: URL : GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino

I also installed the STM32CubeProgrammer software from the link below:

:play_button: https://www.st.com/en/development-tools/stm32cubeprog.html

After completing these steps, I was able to successfully run the Blink example.

However, when I attempted to perform the upload via a USB cable, the process failed with a specific error message.

I followed the instructions in the link below to install the appropriate drivers. Could there be something I missed?

:play_button: https://www.st.com/en/development-tools/flasher-stm32.html

I would appreciate your help in resolving this issue.

Thank you.

Thank you for your kind response.

I’m aware that the configuration in question was incorrect, but at the time, I didn’t know the root cause of the upload issue, so I was changing various settings and happened to take that screenshot during the process.

Fortunately, with help from @ptillisch, I was able to resolve the issue and successfully upload the code.

However, I have an additional question: I would like to upload code to the STM32F103C8T6 (Black Pill) via a USB cable, but it currently doesn’t seem possible.

I believe I need to clarify the details regarding the new issue mentioned earlier.

I connected an FT232BL USB to TTL module to the STM32F103C8T6 (Black Pill) and followed the steps below to upload the STM32duino bootloader and install the Arduino_STM32 driver:

:play_button: STM32 Flash Loader: https://www.st.com/en/development-tools/flasher-stm32.html
:play_button: STM32duino Bootloader: GitHub - rogerclarkmelbourne/STM32duino-bootloader: Bootloader for STM32F103 boards, for use with the Arduino_STM32 repo and the Arduino IDE
:play_button: Arduino_STM32 Driver: GitHub - rogerclarkmelbourne/Arduino_STM32: Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards

I set the BOOT0 pin of the STM32F103C8T6 (Black Pill) to HIGH and uploaded the STM32duino bootloader. After the upload, I set BOOT0 to LOW and disconnected the FT232BL.

Then, I connected the STM32F103C8T6 (Black Pill) directly to my PC via USB and installed the Arduino_STM32 driver. However, in the Windows Device Manager, the board is listed in an unexpected way, and I am unable to select a COM port for the STM32F103C8T6 (Black Pill) in the Arduino IDE.

Additionally, the blue LED on the board kept blinking repeatedly (turning on and off in a loop).

I suspect it may be a driver issue, but I haven’t been able to find a clear solution.

I would appreciate any guidance you can provide regarding this issue.

Thank you.

The driver and bootloader you installed are for RogerClark core. But you now use another core package:

These two packages are not compatible.

If you were able to upload a code via STM32CubeProgrammer - so it could be a good idea to continue to use it.

To supplement what @b707 wrote, I'll direct you to the relevant information in the wiki for the "STM32 MCU based boards" platform: