Can't initiate chip erase

Windows XP,Vista,7,8 and 8.1 etc
thebeline
Posts: 4
Joined: Fri Nov 20, 2015 5:13 am

Can't initiate chip erase

Post by 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):

Code: Select all

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
The board came with the flashing light on. Boot0 is high (turning the flashing light off. Power is via the USB cable, and TX/RX via the USB-Serial adapter. I am cycling reset just prior to write, and have even attempted cycling BUT (PB8) and following the "hold reset, hold BUT, release Reset, release BUT" pattern, but to no avail. I continue to receive the above message...

stevech
Posts: 441
Joined: Thu Aug 27, 2015 6:32 am

Re: Can't initiate chip erase

Post by 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.

User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Can't initiate chip erase

Post by 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
Posts: 4
Joined: Fri Nov 20, 2015 5:13 am

Re: Can't initiate chip erase

Post by 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
Posts: 4
Joined: Fri Nov 20, 2015 5:13 am

Re: Can't initiate chip erase

Post by 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...

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

Re: Can't initiate chip erase

Post by 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...
You are running Windows 10... I do not know if W10 will install and enumerate the USB driver. 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.

So, try and force an install of the W10 drivers... explained here: viewtopic.php?t=32

Good luck,

Ray

User avatar
Rick Kimball
Posts: 1038
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Can't initiate chip erase

Post by 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.
Welcome aboard ;)
-rick

User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Can't initiate chip erase

Post by 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
Posts: 4
Joined: Fri Nov 20, 2015 5:13 am

Re: Can't initiate chip erase

Post by 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).

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

Re: Can't initiate chip erase

Post by mrburnette » Fri Nov 20, 2015 8:29 pm

Rick Kimball wrote: <...>
Welcome aboard ;)
I'm UNIX certified (System V ... tells that I'm an old fart) and I worked before retirement with HP-UX, Solaris, AIX, and Linux from a datacenter architectural high-level view. But other than playing with RAM bootable images of Linux, I'm new ... but I am amazed at how fast this 8-year old notebook with only 2G of RAM runs with a full-install. I do believe it is faster than the original XP. PC has a new life (I'm using it now for this message, in my easy chair, and on the home WiFi... while listing to streaming MP3 from the SMB file server: dual core CPU is threading evenly around 50% and no VM swapping at all. I love it.

Ray

Post Reply