Core stuck cyan flashing after sFLASH_EraseBulk()

Hi,

My core is stuck cyan flashing after using sFLASH_EraseBulk(). Did I erase parts of the firmware? I assumed this so I have been downloading Spark firmware v0.3.4 from GIT and using:

dfu-util -d 1d50:607f -a 1 -s 0x00020000:leave -D core-firmware.bin 

to flash it back on but it still does not get over cyan flashing.

Am I missing something to bring it back to normal?

You may have overwritten the keys stored in flash. Someone else can weigh in but I’d suggest a spark cli keys doctor command which might fix it. See https://github.com/spark/spark-cli#spark-keys-doctor

If I use the key doctor with my CoreID I get some errors:

Error saving key from core... Error: Command failed: unable to load Private Key
140735278523232:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:153:

Error saving key to core... Error: Command failed: unable to load Private Key
140735278523232:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:153:

Make sure your core is in DFU mode (blinking yellow), and that your computer is online.
Error - Error: Command failed: unable to load Private Key
140735278523232:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:153:

Hi @MarkusL,

The CLI is trying to do you a favor by making sure your key is backed up before overwriting it.

Try writing the key manually with:

dfu-util -d 1d50:607f -a 1 -s 0x00002000:leave your_private_key.der

Thanks,
David

The key doctor creates 2 files with .der ending,

pre_<my device>_new.der
<my device>_new.der

which one?

UPDATE: tried both and still flashing…

Hi @MarkusL,

You want the new one, and not the “pre” one (that’s the old one).

Once you’ve written the key, send it to the cloud with:

spark keys send YOUR_CORE_ID CORE_KEY.pub.pem

Thanks,
David

no luck, same cyan flashing. This is the console out:

dfu-util -d 1d50:607f -a 1 -s 0x00002000:leave -D core.der 
dfu-util 0.7

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Filter on vendor = 0x1d50 product = 0x607f
Opening DFU capable USB device... ID 1d50:607f
Run-time device DFU version 011a
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=1, name="@SPI Flash : SST25x/0x00000000/512*04Kg"
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 1024
No valid DFU suffix signature
Warning: File has no DFU suffix
DfuSe interface name: "SPI Flash : SST25x"
Downloading to address = 0x00002000, size = 608
.
File downloaded successfully
Transitioning to dfuMANIFEST state
Error during download get_status

and this:

spark keys send <coreID> core.pub.pem 
attempting to add a new public key for core <coreID>
submitting public key succeeded!

It downloaded to the flash but you might have wiped out more :stuck_out_tongue:

So then how to restore the missing pieces?

@MarkusL,

There are a couple of things to be restored since i have no idea what parts of the external flash did you erase.

Having Spark-cli will be super useful

1.) Restore factory firmware

`spark flash --factory tinker``

2.) Restore Spark :cloud: public key

spark keys server cloud_public.der

https://s3.amazonaws.com/spark-website/cloud_public.der

3.) Restore core public keys with

spark keys doctor CORE_ID which you probably have done

Once that’s done, factory reset the core and it should work well :wink:

4 Likes

@kennethlimcp YOU ROCK!
Thanks - core is alive again!

4 Likes