Can’t initiate chip erase

thebeline
Fri Nov 20, 2015 5:20 am
Just got a Blue Pill and trying to get it running on my W10 box. I followed the install instructions, am using Arduino 1.6.5, and have the BP connected via a USB to Serial adapter. I am attempting to write a (any, really) sketch to the board. As I understand it, writing the initial sketch will bring in the USB bootloader. Regardless, I can not write anything to the board. Instead, I receive the following message (copied from the Command Line after attempting many different ways):

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Got NACK from device on command 0x43
Can't initiate chip erase!
Failed to erase memory


stevech
Fri Nov 20, 2015 8:37 am
Chip erase will erase a bootloader that may be present in flash if the MCU doesn’t have a bootloader in ROM (enabled by a pin jumper).
Chip erase is rarely used/needed.
Flashing a new program will erase the occupied sector(s).
ST-Link also has a menu choice to erase selected sectors.

RogerClark
Fri Nov 20, 2015 9:10 am
It sounds like the chip has been locked, and will need to be fully erased and unlocked before you can do anything

Try downloading STM’s “Flash loader demonstrator” (its not really a demonstrator its the flash uploader via serial)
http://www.st.com/web/en/catalog/tools/PF257525

It has a lot of options, including unprotecting and fully erasing the chip

http://www.st.com/st-web-ui/static/acti … 171488.pdf


thebeline
Fri Nov 20, 2015 2:20 pm
So the idea is to use the set-up I have now (power via USB, Tx/Rx via USB adapter) and flash the bin created by the Blinky Light Sketch to the Pill using the Flash Utility you linked to, forcing a full chip erase and rewrite. At which point the chip will have the USB compatible Serial drivers installed and I can use the Arduino IDE moving forward?

Sound about right?


thebeline
Fri Nov 20, 2015 2:37 pm
Excellent, the chip was locked, and un-locking it with the Flash Demonstrator allowed me to flash using the Arduino IDE.

However, it still does not show up as a DFU device (actually, I am not sure where I would find this, but it does show up as (Device Descriptor Request Failed), so I still must upload via Serial, which, I suppose is fine for testing/development, but I would like to be able to use less wires to program… Alas…


mrburnette
Fri Nov 20, 2015 6:22 pm
thebeline wrote:Excellent, the chip was locked, and un-locking it with the Flash Demonstrator allowed me to flash using the Arduino IDE.

However, it still does not show up as a DFU device (actually, I am not sure where I would find this, but it does show up as (Device Descriptor Request Failed), so I still must upload via Serial, which, I suppose is fine for testing/development, but I would like to be able to use less wires to program… Alas…


Rick Kimball
Fri Nov 20, 2015 7:42 pm
mrburnette wrote:… My W10 box died last week due to the Microsoft W10 update – never to return, it is now Linux. No other machine in my home will ever become W10… too wacky… and I am an ex-MCSE.

RogerClark
Fri Nov 20, 2015 8:01 pm
I’m sure someone else posted that they are using W10 and that it worked Ok.

I would recommend you flash the boot loader using STMs tool and see if the board initially appears as a dfu device, and then upload using the boot loader method, it’s far easier than using serial all the time, as you don’t need to keep boot0 high and don’t need to press the reset button before each upload


thebeline
Fri Nov 20, 2015 8:12 pm
Could you direct me to how to flash the bootloader? I have your Git Repo. I can see how to use some of the utilities via CMD, but this is my first time with anything non-Arduino (strict).

mrburnette
Fri Nov 20, 2015 8:29 pm
Rick Kimball wrote:
<…>
Welcome aboard ;)

RogerClark
Fri Nov 20, 2015 8:34 pm
thebeline wrote:Could you direct me to how to flash the bootloader? I have your Git Repo. I can see how to use some of the utilities via CMD, but this is my first time with anything non-Arduino (strict).

willbird
Wed Feb 03, 2016 11:57 pm
I just got my first Blue Pill the other day. Was having trouble getting anything to upload using Arduino IDE and serial.

Found this thread and went looking for a flash uploader for Linux.
Ended up using stm32flash and this command.

sudo stm32flash -k /dev/ttyUSB0


gilhad
Tue Feb 13, 2018 1:20 pm
Thank you very much :) Saved one of my Blue Pills too :)

Leave a Reply

Your email address will not be published. Required fields are marked *