stm32 nightmares #stm32

kc1at <kc1at@...>

Can anyone point me to a known GOOD step by step instruction on loading this #$%@$## bootloader in the STM32. It seems to load OK but when I take the serial adapter off and plug the STM32 into a USB port windoze10 doesn't see it. If it doesn't see it I can't upload the driver.

Tried 3 or 4 cables no help. My adapter board is a mini usb the STM32 is a micro ( or something smaller) Problem is I don't have any micro USB devices to see if all 4 cables are bad. ughhhh.

A few more glasses of wine and I'm going to try it on Ubuntu.


kc1at <kc1at@...>

Wait....maybe its a bad USB port on the STM32. I got another one around here somewhere. I'll solder some pins to it and try to load the bootloader on that one.


Donald Purnhagen <dpurnhagen@...>

Most of the generic STM32 boards can not be programmed through the USB interface. They can be programmed easily through the pins on the other end, preferably using an ST Link adapter.


Also, there is a jumper that has to be moved for programming, and then moved back to run the program. Here's a good video. The same channel has another video about replacing a surface mount resistor to get the USB port working, but it's probably not worth the trouble.

kc1at <kc1at@...>

thanks Don

Got all those covered. The jumpers the bin files device drivers...Those USB interfaces look like the serial adapter I got but in a nice pretty case

Now the st link flash loader won't work now. It was OK a while ago. It doesn't like the com port selection even thou I can see its connected to com port 4 in device manager.

let me check out that video. I don't think I've seen this guy yet.



Tom, wb6b

If you don't have a boot loader you can program the Blue Pill with a ST-Link adaptor using the pins on the end of the board or the TTL serial UART pins.

To program with ST-Link set the BOOT0 jumper to 0. Hook up the ST-Link (Here is a link that may help and use the ST-Link programmer selection from the Arduino IDE. There is no USB/Serial port to select as the driver talks natively to the ST-Link device. (Just like a mouse or keyboard does not have a serial port associated with it.)

To program through the serial (RX/TX) pins, use a USB to serial cable or adaptor card, making sure it puts out 3.3V levels not 5V (and power if you use it to power the Blue Pill). It might be easiest to power the Blue Pill from a USB cable. At this point the Blue Pill should not show up as a serial port. If it does, then you already have a boot loader installed and there is no need to do any of this other stuff. 

Set the BOOT0 jumper to 1, connect the serial (RX/TX) ground and 3.3v, if you are powering from the USB to serial cable/adaptor. Select the serial programming method and the USB Serial port on the Arduino IDE and "upload" the program to the Blue Pill.

Some USB to serial adaptors supply 5V power even though they are set to output 3.3V levels tor RX and TX, in that case connect the 5V power to the 5V pin of the Blue Pill; if you are choosing to power the Blue Pill from the USB/Serial adaptor. (** The link above claims the RX/TX pins are 5V tolerant. I've been under the impression that they were 3.3v only. So, you may be able to use a 5V output USB to Serial adaptor. I have not tried it.)

The program should run. To get the program to run the next time you power op the Blue Pill you will need to return the BOOT0 jumper to the 0 position.

If the program you uploaded was a boot loader the BOOT0 jumper needs to be in the 0 position for the boot loader to run when the Blue Pill is powered up and be able to upload new programs using the Arduino boot loader programming method.

By the way, Mbed is an on-line alternative to the Arduino system. It is not directly compatible, it is somewhere in the middle between the Arduino platform and hard core development platforms. 

Tom, wb6b

kc1at <kc1at@...>

OK I think I know whats going on.

The bootloader "seems" to load ( all the lights blink as they're supposed to) I swapped the jump back before pulling power BUT then USB port won't recognized the blue pill when plugged into the port.

Donald that video was GREAT. That guy said win10 has issues recognizing the device. That's exactly my problem He gave up trying to use the USB and loads using the ST Link. He mentioned that the USB connector was basically useless. I guess it all depends on what clone ya got.

I'll get one of those ST Link puppies. Since it works natively as you mentioned Tom that should be recognized by win10.

thanks Donald and Tom I think understand it now


Tom, wb6b

On Wed, Oct 2, 2019 at 03:25 AM, kc1at wrote:
lights blink
Very good. There was a person using a Mac, that had to add a path so the Arduino IDE would find the ST-Link uploader software. (The Arduino IDE installs a private copy in a non-standard location.) I don't know if that is a Mac only problem. If you get an error with the ST-Link programmer utility not being found keep that in mind. In my case, I also have a Mac, I'd already installed a copy of the ST-Link programmer utility when I'd previously installed another developer platform, and the Arduino IDE found and used that one.

The Blue Pill boards I have all came with a blink program installed, but no boot loader. I imagine that is their quality control procedure. If it blinks, ship-it.

Tom, wb6b

Mark Hatch

I was the one using the st-link on a MAC.   I had to put th st-link flash in a directory at root:   /stlink .  (It was the Arduino IDE that demanded the /stlink directory.

On Mac, I kept running into an unknown device ID problem on *some blue pills*. I switched all my flashing to my windows laptop, and everything work.

And then I manually executed the flash of the STM32 chip using the command line.

I believe the command line was:

./stm32flash -w generic_boot20_pc13.bin  -v  -g 0x0 /dev/cu.usbserial-00000000 

BTW: When I was flashing using the stlink clone, I never moved the boot jumpers. Kept both at the default position. And it worked fine.  

I was also trying to get the Arduino IDE to flash onto the chip the MCT software. Not sure if I ever got that working. 
I have a command line in my shell history that might have worked:

./st-flash MorseTutor.ino.generic_stm32f103c.bin 

Even so, I seem to remember that there were some sets of Blue Pills that refused to take to the USB bootloader. So you might try a batch from a different supplier....