[SOLVED]Unable to Program Blue Pill in Arduino IDE v1.8.12 on Mac Catalina 10.15.5

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Post Reply
User avatar
dwestbury
Posts: 3
Joined: Sun Jul 05, 2020 7:59 pm
Location: NYC Area

[SOLVED]Unable to Program Blue Pill in Arduino IDE v1.8.12 on Mac Catalina 10.15.5

Post by dwestbury »

I recently purchased two batches of generic STM32F103C's from different suppliers.

I was able to program the first batch of boards using a simple FTDI USB-Serial interface in Arduino IDE v1.8.12 on my Mac running Catalina 10.15.5.

However, I haven't been able to get any of the boards from second batch I ordered to work with my FTDI?

I came across an article that suggested that some FTDI boards are simply incompatible with some Blue Pill variants, so apparently the most reliable way to consistently program them is to use an STLink adapter.

I went ahead and bought a generic STLink v2 from eBay before I realized that setup instructions were fairly sparse for Mac.

For starters, I've tried using STM32 board libraries from STMicroelectronics (v1.9.0) and Roger Clark (https://github.com/rogerclarkmelbourne/Arduino_STM32), but I can't seem to get either to allow me to to program with my STLink v2 .

The first challenge I noticed is that my Mac doesn't seem to recognize my STLink v2 when it's plugged into the USB port? (Confirmed using System Information Utility).

I thought I might have to install a driver first to get my system to detect the device, so I looked for a STLink v2 driver on the ST.com site, but was only able to find a Java file called STLinkUpgrade.jar? Does anyone know where could I place this file to enable my system to detect the device?

I also tried installing the STMCubeProgrammer from ST.com, but this is also only a Java package (SetupSTM32CubeProgrammer-2.4.0) and I haven't been able to figure out where to put this either?

Appreciate any and all assistance that can get me going on this.

Cheers!
Last edited by dwestbury on Mon Jul 06, 2020 4:23 am, edited 3 times in total.

ag123
Posts: 494
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: Unable to Program Blue Pill in Arduino IDE v1.8.12 on Mac Catalina 10.15.5

Post by ag123 »

stories has been going around about fake blue pills
https://www.cnx-software.com/2020/03/22 ... m32-fakes/
https://www.youtube.com/watch?v=ZUj8_va5vLQ
and even if it is genuine i've encountered defective chips or bad boards etc.
the other way to program the board is uart1 (set boot0), if both means fail blinky there is a higher chance it is fake

User avatar
dwestbury
Posts: 3
Joined: Sun Jul 05, 2020 7:59 pm
Location: NYC Area

Re: Unable to Program Blue Pill in Arduino IDE v1.8.12 on Mac Catalina 10.15.5

Post by dwestbury »

For what it's worth, the MCU chips on my boards don't have any of the same red flags listed by the under cnx-software.com link, but they don't have the ST logo on them at all and perhaps worst of all, a simple swipe of an alcohol dipped cotton swab, almost completely removed the print on the chip.

Given the price I paid (less than $2 USD for each board) and the source (AliExpress), I wouldn't be terribly surprised if these were fakes, although I'm still hoping there some way to program them?

Like I said, I've tried an FTDI usb-to-serial programmer, I've tried using an Arduino Uno with it RST shorted to GND as a serial programmer, and now I have an STLink v2 (clone) and can't seem to get this to work?

It might be useful to show the error message I'm getting:

Code: Select all

Arduino: 1.8.13 (Mac OS X), Board: "Eval, SensorTile.box, STM32CubeProgrammer (SWD), Enabled (generic 'Serial'), None, Low/Full Speed, Smallest (-Os default), Newlib Nano (default)"

Sketch uses 9960 bytes (15%) of program storage space. Maximum is 65536 bytes.
Global variables use 844 bytes (4%) of dynamic memory, leaving 19636 bytes for local variables. Maximum is 20480 bytes.
/Users/dwestbury/Library/Arduino15/packages/STM32/tools/STM32Tools/1.4.0/tools/macosx/stm32CubeProg.sh 0 /var/folders/d5/5n5zgcmd6svfhnzwcqx2jjdc0000gn/T/arduino_build_141217/Blink.ino.bin -g 
STM32_Programmer_CLI not found.
An error occurred while uploading the sketch
Please install it or add '<STM32CubeProgrammer path>/bin' to your PATH environment:
https://www.st.com/en/development-tools/stm32cubeprog.html
Aborting!


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
The errors seems to imply that I need to install the "STM32_Programmer_CLI", but all that I can find on st.com is SetupSTM32CubeProgrammer-2.4.0, which doesn't seem to do anything on my Mac?

Thanks again

User avatar
dwestbury
Posts: 3
Joined: Sun Jul 05, 2020 7:59 pm
Location: NYC Area

[SOLVED]Unable to Program Blue Pill in Arduino IDE v1.8.12 on Mac Catalina 10.15.5

Post by dwestbury »

OK.. Fake STM32 chip or not, I've figured out how to get it to program properly with a STLink v2 in the Arduino IDE.

In the end, it was a simple matter of following these directions properly.

It turns out that the SetupSTM32CubeProgrammer-2.4.0 I downloaded from st.com was actually a Mac 'app', which acted like an installer for the actual "STM32_Programmer_CLI"

I was able to get this working by using the Mac Terminal, then navigating to the app folder, showing it's package contents and then navigating to "Contents/MacOs", and finally running "SetupSTM32CubeProgrammer-2_4_0_macos"

Afterwords, I followed the steps here and Voila!

https://github.com/stm32duino/wiki/wiki ... programmer
STM32CubeProgrammer
Since core version > 1.5.0

STM32CubeProgrammer allows to write and verify device memory through both the debug interface (JTAG and SWD) and the bootloader interface (UART, USB DFU, I2C, SPI, and CAN).

Since version 1.6.0, three upload methods are based on the STM32CubeProgrammer CLI (command-line interface):

SWD
Serial
DFU
Requirement
To use those upload methods, STM32CubeProgrammer have to be installed manually as it is not provided through the tools packages.

User can change the default install path but in this case, the new path have to be added in the PATH environment variable.

Default path of STM32CubeProgrammer binary:

Linux: $HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
Mac: /Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOs/bin
Windows:
32 bits: %ProgramFiles(X86)%\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
64 bits: %ProgramW6432%\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
To add your custom installation path you can refer to this HowTo

In any case, if the STM32CubeProgrammer binary is not found, user will be warned like this:

STM32_Programmer.sh/STM32_Programmer_CLI.exe not found.
Please install it or add '<STM32CubeProgrammer path>/bin' to your PATH environment:`
https://www.st.com/en/development-tools ... eprog.html`
Aborting!
Some other notes that might be useful to others.
I'm using the standard "STM32 Cores" Board library from STMicroelectronics v1.9.0
Additional Boards Mgr. URL:
"https://github.com/stm32duino/BoardMana ... index.json"

When you use a STLink programmer, it seems you no longer need to worry about moving the boot 0/1 jumper or pressing the reset button.

It just works...

Cheers all.

Post Reply

Return to “IDE's”