[fake-stm32-blue-pill-board] STM32F103C8T6 Bootloader/Sketch problems

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Korishan
Posts: 7
Joined: Sun Dec 23, 2018 2:08 pm

[fake-stm32-blue-pill-board] STM32F103C8T6 Bootloader/Sketch problems

Post by Korishan » Sun Dec 23, 2018 4:36 pm

Moderator note: skip ahead to potential conclusion


Hello everyone,

I've started off using Arduino Nanos and built a couple little projects. One is a power meter for the house mains. It is based off of the OpenEnergyMonitor project. Works pretty good, but just not the resolution I need/want.

I've started off using Arduino Nanos and built a couple little projects. One is a power meter for the house mains. It is based off of the OpenEnergyMonitor project. Works pretty good, but just not the resolution I need/want.

So I got some STM32F103C8T6 boards. Here are the ones I got: ebay.com/itm/323591665224

moderator edit, seller relisted as
https://www.ebay.com/itm/STM32F103C8T6- ... 3632180484


I would like to use one of these to upgrade the Energy Monitor project to a faster and greater resolution.

My current problem is that I can't seem to flash it with anything "other" than the firmware that came with the boards. I used the STM Demonstrator GUI program to pull a good copy of the firmware off the boards. I use this to reflash the boards if something doesn't work (which is 100% atm). The default firmware will bootup and flash PC13 at about 1000ms.

I have tried flashing:
generic_boot20_pb12.bin
generic_boot20_pc13.bin
generic_boot20_pc13_fastboot.bin
maple_mini_boot20.bin

All of which do not show up when I connect via the USB cable. I know the cable works as it works just fine with several other devices (cell phones, tablets, etc). The only way I can flash is using an FTDI232 board. I have even tried compiling the Arduino blink and then using the Demonstrator to upload the bin file, and it still didn't blink.

Here's the code I'm using:

Code: Select all

int pins[] = {PC13, PC14, PC15};
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin PB1 as an output.
  for (int i = 0; i < 3; i++)
  {
    pinMode(pins[i], OUTPUT);
  }
}
// the loop function runs over and over again forever
void loop() {
  for (int i = 0; i < 3; i++)
  {
    digitalWrite(pins[i], HIGH);
  }
  delay(500);              // wait for a second
  for (int i = 0; i < 3; i++)
  {
    digitalWrite(pins[i], LOW);
  }
  delay(500);              // wait for a second
}
I used the array to see if maybe the LED wasn't really on PC13, even though the silk screen was labeled as such. I even tried the PWM sketch to have a fading led, and still nothing.

Another thing to note, I followed the advice of roger and went to the wiki where it shows the boards are shipped with the wrong resistor value. Sure enough, my boards have the 10k instead of the 1.5k. But, this is for direct USB control. Even after adding resistors to get 1.5k across the two pins, I still couldn't detect the board properly in Device Manager. It shows up as "Unknown USB Device (Device Descriptor Request Failed)". I know that's a different problem, but figured I'd mention it here in case it might be related.

System:
Windows 10 Pro 10.0.17134 Build 17134
AMD FX-6100
Arduino 1.8.5

TIA,
Kori

User avatar
mrburnette
Posts: 3001
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by mrburnette » Sun Dec 23, 2018 9:22 pm

You purchased this: http://stm32duinoforum.com/forum/index.php?title=Blue_Pill

Go here: http://stm32duinoforum.com/forum/index.php?title=Main_Page
Read:
  • Installation
  • Bootloader
  • Uploading a sketch
With Windows, you must install drivers: http://stm32duinoforum.com/forum/index.php?ti ... stallation

Korishan
Posts: 7
Joined: Sun Dec 23, 2018 2:08 pm

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by Korishan » Sun Dec 23, 2018 9:39 pm

mrburnette: I did that, all of those steps. Nothing's working. That's why I'm here :?

User avatar
mrburnette
Posts: 3001
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by mrburnette » Sun Dec 23, 2018 10:05 pm

Korishan wrote:
Sun Dec 23, 2018 9:39 pm
mrburnette: I did that, all of those steps. Nothing's working. That's why I'm here :?
OK.

What I can tell you that the procedures work for 99% of the forum members. This leads us to Blue Pill users on Windows 10 Pro who are having similar issues... which breaks down into bad hardware, wrong/overwritten bootloaders, bad cables (try another), of a non-standard Windows installation or other Win issues such as premissions, relocated directories, failed IDE installs, etc.

Maybe Google using this criterion:
blue pill download problems site:stm32duinoforum.com/forum

You have not given much information with which to work. You may have destroyed the bootloader by uploading the .bin file; you could try a serial interface. ArduinoIDE generally expects to be used with the bootloader. Serial upload or ST Link overwrite the bootloader. Of course, you already read that here: http://stm32duinoforum.com/forum/index.php?ti ... g_a_sketch

Ray

Korishan
Posts: 7
Joined: Sun Dec 23, 2018 2:08 pm

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by Korishan » Sun Dec 23, 2018 11:40 pm

I know it works for most people. That's why I came here to figure out if anyone has had any issues like this before and what could work to fix the problem.
I have used both Arduino IDE and the STM Demonstrator Flash program, a separate USB cable, tried to get the resistor value down to 1.5k for USB interface. I'm using an FTDI232 interface, which works. The Demonstrator program will talk to the board and get the stats of the board just fine, this is not saying there is still something wrong with the board but this does show that the FTDI and the USB cable are working to talk to the board.

I haven't given much info because I don't know "what" to give. I have told you exactly what I have done, and exactly what the results are. I haven't tried any other methods as I don't 'know' what other method to try.

Images of Flashing using Demonstrator

Even after the "successful" uploads, when I plug in the usb directly to the stm32 board, I get the unknown device, which is also in the image. Also, the code does not run in either connected to the usb directly, or connected through the ftdi connection.

Are these boards dead? If so, why do they seem to take a flash, but then won't run it? I don't get that. Do I need to contact the seller and tell them all 5 of the boards I received are dead?

User avatar
mrburnette
Posts: 3001
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by mrburnette » Mon Dec 24, 2018 3:21 am

Korishan wrote:
Sun Dec 23, 2018 11:40 pm
... exactly what I have done, and exactly what the results are. I haven't tried any other methods as I don't 'know' what other method to try.

Images of Flashing using Demonstrator

Even after the "successful" uploads, when I plug in the usb directly to the stm32 board, I get the unknown device, which is also in the image. Also, the code does not run in either connected to the usb directly, or connected through the ftdi connection.

Are these boards dead? If so, why do they seem to take a flash, but then won't run it? I don't get that. Do I need to contact the seller and tell them all 5 of the boards I received are dead?
Most boards have a Blink sketch but few have a DFU bootloader; exception Maple Mini.

So, I keep pointing you to the WiKi references but I guess I need to explain a bit more.

You can only use DFU if there is a bootloader installed: http://stm32duinoforum.com/forum/index.php?ti ... bootloader

It is the bootloader that supports DFU. No bootloader or corrupted bootloader, no DFU.

But, Windows must have a driver successfully installed for DFU to enumerate over USB. Windows users often have driver install issues... 2 or 3 failures per month, I guess. You can use forum or Google search to read these posts.
Upload via STM32duino bootloader
First, you need to ensure you have the drivers for the Serial and DFU (upload) devices installed -- see Installation for instructions.

Also, your STM32 board needs to have the STM32dunio bootloader -- see Burning the bootloader.

If your board does not yet have a sketch running, it appears as a Maple DFU device. This will be used to upload the first sketch.

Once a sketch is running, the DFU is not present, but the Maple Serial device is. Select its COM port from the Tools -> Port menu.
Both serial upload and ST-Link overwrite the bootloader... bye bye bootloader.

You purchased a cheap piece of hardware. You modified the board to use the USB enumeration. You used a utility to create a backup and it "appears" to me you used the utility to re-flash the uC. That is not something I can address ... your bootloader+sketch may or may not have been successfully replaced... or you may never have had abootloader!

I suggest:
Try to (re)install the DFU bootloader using the above link.
-OR-
Load the bootloader 2.0 sketch using serial/STLINK and let the sketch burn a good bootloader copy.

Good luck,

Ray

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by stevestrong » Mon Dec 24, 2018 8:02 am

It may happen that all of those boards have a problem with USB connector, if they are from the same set.
Check again the USB pin soldering, and re-solder them if needed.

I suggest to use STLink for upload (set it in Arduino IDE) and try the blinky sketch.
PC14/15 is bad to use because the 32kHz xtal (for RTC) is mounted on those pins. Use only PC13.

fredbox
Posts: 211
Joined: Tue Jul 07, 2015 4:44 pm

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by fredbox » Mon Dec 24, 2018 5:53 pm

Blue Pill detailed instructions (Windows 10):
1. Enable the native bootloader by setting Boot0=1 and Boot1=0.
2. Connect your USB/Serial adapter to pins PA9, PA10, GND, and 3.3V.
3. Flash this bootloader using the ST demonstrator GUI: https://github.com/rogerclarkmelbourne/ ... 0_pc13.bin
4. Set both boot jumpers = 0. This enables the board to run the new bootloader that you just uploaded.
5. Use a USB cable to connect to your computer. Press reset on your board. You should see the LED blink rapidly for about a second followed by about 5 slower blinks for another second.
6. Check device manager. You should see a new USB Serial device in "Ports and LPT."
7. Use PuTTY or another terminal program to connect to the serial device noted in step 6. The default serial settings (baud rate, etc) for PuTTY are ok but you will need to change the COM port to match device manager.
Verify that you see this message repeating about every second on the PuTTY screen:

Code: Select all

Congratulations, you have installed the STM32duino bootloader
See https://github.com/rogerclarkmelbourne/STM32duino-bootloader
For more information about Arduino on STM32
and http://stm32duinoforum.com/forum
For step 3, you probably will need to use the ST GUI to remove the write protection from the board. The last boards I received had a blink program preloaded but were not writable until the protection was removed. Also, make sure you have the RX and TX wires correctly connected. Reverse the wires if needed.

For step 6, if you see "Unknown device," then you will need to run the batch file to load the drivers.

Korishan
Posts: 7
Joined: Sun Dec 23, 2018 2:08 pm

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by Korishan » Mon Dec 24, 2018 10:34 pm

Thanks stevestrong. I considered looking at that as I've seen it in other posts. I checked the connections and they seem fine. I don't have a fine tip iron, or a way of properly magnifying to see clearly the solder points.

Also, the blink sketch should work even if being uploaded through the usb serial link. So there's still that problem.

I agree with the STLink, I just don't have one. I got the FTDI232 as it was one of the best (that I could gather from various sources) serial uplinks. I will probably get an STLink interface in the future, tho. It will be nice to have different tools to check different things with.

fredbox: Yep, totally agree. I followed those instructions to the letter, multiple times.


Here's the video I sent to the seller: https://youtu.be/5DsDhkl3bpE

Korishan
Posts: 7
Joined: Sun Dec 23, 2018 2:08 pm

Re: STM32F103C8T6 Bootloader/Sketch problems

Post by Korishan » Mon Dec 24, 2018 10:40 pm

fredbox wrote:
Mon Dec 24, 2018 5:53 pm
For step 3, you probably will need to use the ST GUI to remove the write protection from the board. The last boards I received had a blink program preloaded but were not writable until the protection was removed.
This is interesting. I missed this when I posted the previous reply. I'm testing this out now. I didn't know you could do this. Please stand by.....

---------------------------------------------------------------

Nope, didn't work. :x

I reloaded the Demonstrator and saw the remove write protection. I did that, but it didn't change the end result. grrrr

Post Reply