Problem uploading to STM32F103C8T6 board

Post here first, or if you can't find a relevant section!
Duco
Posts: 4
Joined: Wed Apr 15, 2020 5:55 pm

Problem uploading to STM32F103C8T6 board

Post by Duco »

Hi all,

Recently I decided to upgrade from an Arduino to an STM32 board. I bought my board from https://www.ebay.com/itm/323747797666 (seller stopped selling but it should be the generic 'blue pill' module) and I got the programmer from
https://www.ebay.com/itm/FT232RL-3-3V-5 ... 2749.l2649, but I've not been able to enjoy them that much:

The problems lies when uploading to the board. I have tried a number of things before posting here, none of which helped. I have viewed many forums of people with similar problems, none of which solved my problem. My guess is a faulty programmer, let me explain:

First thing I noticed when uploading for the first time was this error message:

Code: Select all

Failed to init device.
stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 115200 8E1
This was immediately seemed odd to me. Whenever I unplugged the programmer from my breadboard and then uploaded the same sketch, the same error message showed up. This told me that possible wrong connections weren't the immediate problem. I have setup the Arduino IDE properly as well as the connections made from board to programmer (you have to take my word on this).

Next I tried reinstalling the IDE as well as the hardware files to support STM32 boards. I also tried doing the exact same thing on another machine, with no changing result.

After this I tried 'buring the bootloader' with this https://www.instructables.com/id/Progra ... l-Via-USB/ instructable as help. This failed at step 4 when trying to use the stm32 flasher. I selected the port and changed no other setting. The software gave me the following error message:

Code: Select all

No response form the target, the Boot loader can not be started.
Please, verify the boot mode configuration and the flash protection status, Reset your device then try again...
Again, when unplugging the programmer from the board, the same error message came up

When this failed as well I tried installing another stm32 flasher form this link https://sourceforge.net/p/stm32flash/wiki/Home/. When selecting my device with this command

Code: Select all

stm32flash COM11
it gave me an error message similar to the first one I got:

Code: Select all

stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_w32: 1152008E1
Failed to init device.
Lastly, I tried uploading a sketch with the same programmer to an Arduino Nano, with no result once again. The Nano is not faulty for sure because with a normal usb cable uploaing did work.
So my conclusion is a faulty programmer. Before buying a new one I would like to be sure and I want to understand why it is not working.

By now I have become quite desperate for this to work, so any help would be appreciated.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Problem uploading to STM32F103C8T6 board

Post by mrburnette »

OMG ... you do sound frustrated.
I will tell you this, some members have reported counterfit microcontrollers. This may not be your case, so before freaking-out, take a deep breath...

OK. Let's try and get you started with Roger's core and the bootloader. Here is the github:
and the WiKi explains installing the bootloader, etc.
https://github.com/rogerclarkmelbourne/ ... STM32/wiki

Clone programmers sometimes work, sometimes do not (work.) You can always avoid that concern and just load your sketch via serial:
https://github.com/rogerclarkmelbourne/ ... 103-boards

If the above works, great. If not, read my recommendation below:

- you can beg for more help here and perhaps one of the members can walk you through testing the uC, etc. If you think you board may have a counterfeit controller, you can read about it here: viewtopic.php?f=7&t=80 BUT please, please read the last post.

- But if your really want to work with STM32 and you want a great experience, buy one of the supported known good boards listed on the STM support page:
https://github.com/stm32duino/Arduino_Core_STM32
Nucleo and Discovery boards are a good value when you realize that an official ST-Link is included on the board. Schematics and documentation are available. Frederic Pillon from STM runs the forum and has support back into STM for serious questions. Everyone needs 1 (one) known-good board: if for no other reason that to make a determination between hardware and software issues!

Good luck,

Ray
stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: Problem uploading to STM32F103C8T6 board

Post by stas2z »

@mrburnette
seems like he already tried serial, cuz he is talking about ft232rl (fake highly likely) usb ttl and call it "programmer"
Duco
Posts: 4
Joined: Wed Apr 15, 2020 5:55 pm

Re: Problem uploading to STM32F103C8T6 board

Post by Duco »

I wasn't trying to sound frustrated buy I actually am indeed :)

About the stm32 core and the bootloader; I am pretty sure I have those correctly installed.
You can always avoid that concern and just load your sketch via serial:
Do you mean with 'via serial' uploading with the FDTI programmer I have? I have tried this numerous time without success...

I need a small sized board for my project so a 'black pill' https://robotdyn.com/catalog/developmen ... ields.html should fit my requirements and it is said to be supported. But wouldn't I still have the same problem then if my programmer is broken?
Also I think I am a bit lost in what a 'bootloader' actually is, can you maybe link to a good explanation as to what they are?.

Thanks for your help Ray!
fredbox
Posts: 125
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

Re: Problem uploading to STM32F103C8T6 board

Post by fredbox »

As mentioned elsewhere in this forum, most of these boards come with the flash write protected and have to be unlocked before general use. Is your led blinking with both jumpers set to 0? Also, the quality control on these boards is awful. You should buy at least 3 boards in hopes that one of them is usable. I don't think I've ever gotten a shipment of 3 blue pill boards where all of them worked the first time. They have had unsoldered or broken traces or fake/mislabeled CPUs.

Every Black Pill board (the original, not the RobotDyn) I have ever ordered has worked without incident after unprotecting the flash.

Save yourself some frustration and order a better class of board. I've not yet used the RobotDyn board but they will be the next ones that I buy.

The bootloader simply allows uploading through the USB port without moving any jumpers. For uploading with a ST-Link device, you can leave both jumpers at 0. For uploading through a serial device, set boot0=1. Personally, I upload using the ST-Link clone 95% of the time with no bootloader installed.

For windows, you will want to use the ST-Flash loader/demonstrator program and a USB/Serial adapter connected PA9/PA10 to disable write protection, Once the CPU is unprotected, you can write the bootloader using the same method. That instructable looks mostly correct. Be aware that RX and TX labels on USB/Serial adapters are merely suggestions. I have some where TX connects to A10 and others that TX connects to A9.

Verify basic connectivity on the USB/Serial adapter by jumpering RX to TX. Open Putty and select the Com port. Type on your keyboard and you should see the results on the screen.
Duco
Posts: 4
Joined: Wed Apr 15, 2020 5:55 pm

Re: Problem uploading to STM32F103C8T6 board

Post by Duco »

Ok, thanks for the information.
I'm still pretty sure my programmer https://www.ebay.com/itm/FT232RL-3-3V-5 ... %7Ciid%3A1 is faulty so I will have to buy a new one anyway (except if I buy one with the arduino bootloader preinstalled, right?). What would be a better class serial programmer? Maybe this one https://robotdyn.com/usb-serial-adapter ... -3-3v.html?

Again, just to be sure I don't waste money, will this https://robotdyn.com/default/black-pill ... board.html board do quality wise and will it be compatible so to say with the Arduino IDE?

My LED is blinking with any combination of jumpers... I guess that's a bad thing then.
stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: Problem uploading to STM32F103C8T6 board

Post by stas2z »

Duco wrote: Thu Apr 16, 2020 7:15 am(except if I buy one with the arduino bootloader preinstalled, right?).
Nope, you got it wrong.
First, the thing you have is not a programmer. It's just a converter, from usb to serial ttl. Programmers are a bit different thing.
All mcus generally support in-chip programming, for atmega(arduino) it's called isp (ICSP port on arduino, USBASP as an example of programming device), for stm32 it can be SWD or JTAG (ST-LINK V2 programmer for example)
But also devices may support flashing via serial, this became possible with special firmware, called bootloader, which start before your program and allow you to interrupt normal start and program your chip by serial (with your usb-ttl converter). For atmega/arduino - this bootloader shipped with boards preinstalled.
Stm32f103 have it's own BUILT-IN system bootloader which supports serial flashing without special external bootloaders. It can be activated by pulling boot0 up before power on. After that internal bootloader accept flashing commands. Also, for extended functions (like flashing directly via usb, without converter) you can install stm32duino bootloader (implements DFU, direct firmware update) or HID bootloader (it own HID flashing api), it can be installed directly using st-link programmer or usb-ttl converter by calling _system_ bootloader.
For some other stm32 chips system bootloader can support USB DFU programming "from th box".
Duco wrote: Thu Apr 16, 2020 7:15 am What would be a better class serial programmer? Maybe this one https://robotdyn.com/usb-serial-adapter ... -3-3v.html?
CH340 is chinese usb-ttl converter chip, it's ok and probably will be better than fake ftdi chip you got. But i prefer cp2102 based devices for usb-ttl (like this one https://robotdyn.com/default/usb-ttl-se ... usb-a.html )
Duco wrote: Thu Apr 16, 2020 7:15 amAgain, just to be sure I don't waste money, will this https://robotdyn.com/default/black-pill ... board.html board do quality wise and will it be compatible so to say with the Arduino IDE?
no, it's not a STM32, it's a clone (not fake, but clone, and 100% compatibility is not guaranteed)

https://robotdyn.com/default/stm32-arm- ... dered.html
this one will have original chip manufactured by ST Micro and will have arduino compatible bootloader (i assume stm32duino) preinstalled
Duco
Posts: 4
Joined: Wed Apr 15, 2020 5:55 pm

Re: Problem uploading to STM32F103C8T6 board

Post by Duco »

Ok, thanks for the reply.
I guess the lesson I learned from this was not to buy crappy components from crappy websites.
I'll order new microcontrollers + converters (!) from robotdyne so my problem is solved in a way. Thanks again.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Problem uploading to STM32F103C8T6 board

Post by mrburnette »

stas2z wrote: Thu Apr 16, 2020 8:17 am ...
Duco wrote: Thu Apr 16, 2020 7:15 amAgain, just to be sure I don't waste money, will this https://robotdyn.com/default/black-pill ... board.html board do quality wise and will it be compatible so to say with the Arduino IDE?
no, it's not a STM32, it's a clone (not fake, but clone, and 100% compatibility is not guaranteed)
...
I have placed an order, will test with the IDE basic upload, generic sketches, serial, etc. At this time, I have not read any posts that suggest it will not work with the Arduino IDE using a DFU upload or serially using the built-in bootloader.

I have the same concerns regarding 100% comparability, only testing will tell. As the STM32F103 is over 10 years old, there is the possibility that STM has licensed any patents or proprietary technology. The ARM core for M3 designs is licensed out of the UK and those licenses likely include some bus and clocking specifications, too. So, one needs to only be concerned with internal glue logic, peripheral registers, I/O registers and drivers, and do forth. The Chinese foundries and engineering are clearly up to the task of building a higher-performing uC based on xxxF103 baseline.

Ray

PS: brief discussion of using the built-in bootloader:
https://github.com/rogerclarkmelbourne/ ... 103-boards

PPS:
"Frustrating" is the concern over all these posts about faux STMF1xxx microcontrollers. I purchased a small supply of Maple Mini (Baite) boards in the"old" days of Roger's forum and a while later a small supply of blue boards. I have never had a MapleMini clone to fail and about 1::10 blue boards require hot-air rework. All of this was in earlier forum days when I was active there.

FOR NEW USERS JUST STARTING OUT
Please consider purchasing from a supplier with known-good history. Chinese suppliers are numerous and come and go from the marketplace (AliExpress and eBay.) Read reviews and do not order simply on saving a small amount per board.
fredbox
Posts: 125
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

Re: Problem uploading to STM32F103C8T6 board

Post by fredbox »

Also search Youtube for help. This video is a couple of years old but it looks similar to your hardware: https://www.youtube.com/watch?v=Tm7IWQLrKYs
Post Reply

Return to “General discussion”