I bricked my very first Blue Pill - can you see what I did wrong?

Any other microcontroller based boards
Post Reply
User avatar
wanders
Posts: 11
Joined: Tue Jun 18, 2019 9:27 pm
Location: Austin TX USA
OS: Windows, Linux
IDE: Arduino
Board: Bluepill, Arduino Mega 2560, LPC14u11, RPi V3a

I bricked my very first Blue Pill - can you see what I did wrong?

Post by wanders » Tue Aug 06, 2019 5:53 pm

I got my very first BP (which even had a 1.5K resistor at R10, BTW), and I did the usual thing of putting Roger's USB bootloader (using a USB-TTL interface and the Boot0 method) on it and playing with a few blinky sketches using the official STM core and Arduino. Passed a few pleasant minutes making the thing blink.

Then I decided that I wanted to use a smaller bootloader, so I used the same USB-TTL interface and stm32flash to install the 2K HID bootloader, again using the Boot0 method. with a command line:

Code: Select all

         stm32flash.exe -g 0x8000000 -b 115200 -w hid_generic_pc13.bin COM4
Things started going south from there.

The board quit working (blinking) and was unresponsive to Boot0 protocol on USART1. I got an ST-Link V2 and found that the board would not connect in either "normal" nor "connect under reset" modes. I did get it to connect in "hot plug" mode, and found that read-out protection was enabled in apparently irreversible way. I could not reset the read-out protection (or flash write protection) using the "Option Byte" dialog of the ST-Link utility. So the board/MCU looks bricked.

What did I do wrong? I figure the possibilities are:

1) Infant mortality - the BP gave up the ghost, and what did I expect for two bucks?

2) Somehow, I flashed over the option byte area in a bad way, and caused this. This seems unlikely, because if I'm reading the relevant app note (PM0075) correctly, one needs to write a special "key sequence" to a given address to lock up the flash / option bytes.

3) Something else?

Please let me know if you see anything suspect in what I did. I've got a few more BPs on order and would rather not kill them similarly.

Also, am I missing a way to unlock the MCU with ST-Link?

BTW, the STMicro "feature" of allowing a programmer to permanently brick a chip as a method of preventing someone from reading out proprietary code seems like a callous ploy to sell more chips. You should always be able to restore a chip to a "fab fresh" state by doing a full-chip erase, IMO.

Thanks in advance,

Willie
Last edited by wanders on Tue Aug 06, 2019 10:21 pm, edited 1 time in total.

User avatar
Vassilis
Posts: 149
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by Vassilis » Tue Aug 06, 2019 7:01 pm

Connect BOOT-0 jumper to '1' and then press the reset button on bluepill PCB. Release the reset button. That will put the bluepill in programming mode.
Do a full chip erase. You can choose either serial or st-link to program the new firmware.

It is better to use the latest stm32flash or the flasher-stm32 tool

After you burn the new firmware, connect BOOT-0 jumper to '0'
-Vassilis Serasidis

User avatar
wanders
Posts: 11
Joined: Tue Jun 18, 2019 9:27 pm
Location: Austin TX USA
OS: Windows, Linux
IDE: Arduino
Board: Bluepill, Arduino Mega 2560, LPC14u11, RPi V3a

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by wanders » Tue Aug 06, 2019 7:50 pm

Vassilis,

THANKS for all you do here - it is definitely appreciated. I won't be asking for indemnification...ahem.

The Boot0/USART1 bootloader is not working. It will not respond to the 0x7F code sent to the port. So while I can see into the chip (using "hot plug" mode from ST-Link) I can't get the chip to respond to the most basic bootloader. I suspect that the "hot plug" inspection is just using JTAG-type resources to read the memory map, and is not using the ARM core.

Specifically, when I follow Vassilis' instructions (Boot0 high, reset, attach ST-Link, full chip erase) I get the message box "Read out protection is activated" from the ST-Link application. And I'm connected in "hot plug" mode - I cannot connect otherwise.

Willie

User avatar
Vassilis
Posts: 149
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by Vassilis » Wed Aug 07, 2019 1:10 pm

I assume that you have the BOOT-1 jumper connected to '0'. Right ?
In other case, the MCU does not go into programming mode through Serial.

Serial dongleSTM32F103
RXPA9
TXPA10



If the ST-Link works on your board take a screenshot of your Bluepill


st_link.JPG
st_link.JPG (112.3 KiB) Viewed 366 times
-Vassilis Serasidis

User avatar
wanders
Posts: 11
Joined: Tue Jun 18, 2019 9:27 pm
Location: Austin TX USA
OS: Windows, Linux
IDE: Arduino
Board: Bluepill, Arduino Mega 2560, LPC14u11, RPi V3a

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by wanders » Wed Aug 07, 2019 3:46 pm

Vassilis, thanks for the reply! I already took a snap of the option bytes page, to wit:

OptionBytes.png
OptionBytes.png (111.17 KiB) Viewed 357 times

Note that this is all gathered in "hot plug" mode, and when I try to disable read-out protection or unprotect flash, it fails.

User avatar
Vassilis
Posts: 149
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by Vassilis » Thu Aug 08, 2019 9:42 am

My ST-Link V2 board has firmware V2J34S7. Maybe updating the ST-Link firmware will help
STM32 ST-LINK Utility

STM32 ST-LINK Utility > ST-LINK > Firmware update > Device Connect > Yes

You can also reduce the SWD frequency to 480 kHz (Settings menu)

I tried to replicate the problem you were having but it was impossible for me to brick my own Bluepill :lol:
-Vassilis Serasidis

mrburnette
Posts: 90
Joined: Fri Mar 29, 2019 2:22 am
Answers: 1
OS: Linux
IDE: Arduino
Core: Any
Board: Blue, MM, Black

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by mrburnette » Thu Aug 08, 2019 2:48 pm

Vassilis wrote:
Thu Aug 08, 2019 9:42 am
...
I tried to replicate the problem you were having but it was impossible for me to brick my own Bluepill :lol:
Thank-goodness that you failed in that endeavor! I've done some pretty weird stuff with the pill boards and have not bricked one (yet.) Until this thread, I would have said that they were essentially un-brickable but I guess the Universe still respects Murphy's Law. Sorry Willie.


Ray

User avatar
wanders
Posts: 11
Joined: Tue Jun 18, 2019 9:27 pm
Location: Austin TX USA
OS: Windows, Linux
IDE: Arduino
Board: Bluepill, Arduino Mega 2560, LPC14u11, RPi V3a

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by wanders » Thu Aug 08, 2019 4:26 pm

@Vassilis, thanks again for all the advice. Alas, my BP still is unresponsive in all but the "hot plug" mode, which I think only scans the on-chip resources (memory map) and doesn't use the processor itself.

@mrburnette, thanks for responding.

I think that "Bones" McCoy was correct when he said, "It's dead, Jim." I'm pretty sure that at this point, the STM32f103c8t6 isn't bricked so much as it is simply dead (infant mortality). I really don't see how I could have bricked it by writing a bootloader. I'll just wait for my next shipment of BPs to arrive and go from there.

So, thanks again and case closed...

mrburnette
Posts: 90
Joined: Fri Mar 29, 2019 2:22 am
Answers: 1
OS: Linux
IDE: Arduino
Core: Any
Board: Blue, MM, Black

Re: I bricked my very first Blue Pill - can you see what I did wrong?

Post by mrburnette » Thu Aug 08, 2019 6:45 pm

wanders wrote:
Thu Aug 08, 2019 4:26 pm
...
I'll just wait for my next shipment of BPs to arrive and go from there.
...
Willie,

I'm outside Atlanta, so if you ever need a Blue Pill or two, I can always mail you one in a pinch... although, the comments on AliExpress suggest that the old 4 - 6 week wait is down to 2 weeks or so and I am likely not much faster :lol:

Also, I have a project or two on my projects page around the MM/BP from a few years back when I was actively playing with 'em...


Ray

Post Reply