Tutorial: Upgrading Factory Reset Firmware

This is for :spark: core owners who would like to upgrade their factory firmware from V01 to the V02 that is on the new core manufactured!

Continue only if you understand the possible risk of ending up with a non-functioning core (which still can be revived) which you have to troubleshoot

  1. The way to tell which FR-firmware now is to enter Listening Mode (Press Mode button for 5s)

  2. Using a Terminal, enter 'w' to send Wifi Credentials

  3. If your core prompts you for 'Security type', you are on V02 and you don't need to upgrade :smiley:

  4. If you are only asked for SSID and Password, then you are on V01

*Allow me to say that this is not the best way to determine the FF-firmware in future versions (V03, V04, V05) but right now that's the key difference between V01 & V02

This tutorial will be updated in future should there by a way to determine the Core FF-firmware Version, maybe just a simple 'V' command over usb for example


Pre-check!


Make sure you have already done installed the DFU-driver for Spark Core in order to continue.

If you have not or have no idea what I just mentioned.....you probably need to do it :smile:

Instructions here: > Tutorial: Installing DFU-Driver on Windows [24 Feb 2015] - #2 by kennethlimcp - Tutorials - Particle


How to put your core in DFU-mode


  1. Press on BOTH buttons
  2. Release only the Reset button
  3. Release the Mode button once the core start blinking yellow
  4. This will be the dfu-mode smile

Alright time to upgrade!


  1. Go to Release spark_2 Ā· particle-iot/device-os Ā· GitHub and download the file

  2. Put your :spark: core in DFU mode

  3. On your terminal, enter the following command:

  • Check if the core is detected

    dfu-util -l

  • Download the original fr-firmware just to be safe (128KB)

    dfu-util -d 1d50:607f -a 1 -s 0x00020000:0x00022000 -U backup_frfirmware.bin

  • Upload the latest fr-firmware (V02)

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

You will be able to find the V02 firmware named as 'core-firmware.bin' in the zip/tar.gz file you downloaded in the folder 'build'


Once that is completed, your core will reset!

Perform a Factory Reset (Particle Welcome to the Particle docs) & make sure that the core functions as per normal :smile:

Updated on: 19 March 2014

1 Like

Hey @kennethlimcp,

I think you mean 0x00020000, no ?

Thanks,
David

Thanks @dave!

I wonder what was I thinkingā€¦ haha!

1 Like

Time for the v command.

TOTALLY :smiley:

Thatā€™s isnā€™t hard at all if we just add another ā€˜vā€™ to be read during factory reset and hardcode the version for now.

@david_s5 are you gonna do it or shall i attempt to do it? :smile:

The command is the easy part, it is the build, minor number creation, weather the working directory is modifies, and not rebuilding that file each time part of it that requires the work.

But the factory-firmware isnā€™t changed that oftenā€¦

I think for the golden versions weā€™re using an environment var to set a define in the code, so the ā€˜vā€™ command could just spit that define out, yeah?

Yes and no. Look at it from a user POV.

What do we present

Major.Minor.Rev.build *** good info ***

Or

Major.Minor.Rev.build Built: Thu, 21 Dec 2000 16:01:07 +0200 ah Mo' betta

Major, Minor and Rev can come from the const in the MakeFile?

build come from the version control system. (the trick is making one number from three repos (the knot) and not making it a human dependent task.

the timestamp would reflect the time of the build.

Like I said above and in the last message to get the build is tricky but it can be done with make. The timestamp is worse.

I see the total revision number solution best solved with an makefile , script an API for reading and embedded ID and, some linker magic.

But yes you can do all but the timestamp statically, but guarens at some point, late one night, after a marathon sprint, someone will forget to "bump the rev"

Aloha,

Hmm, we could increment a version integer in the build IDE after each save, and/or a date/time stamp (code time vs. build time), and then also have a compile/flash stamp from the makefile with something like NOW := $(shell date +"%c" | tr ' :' '__') in the makefile ( from here: http://stackoverflow.com/questions/12463770/insert-time-stamp-into-executable-name-using-makefile )

Since the RTC lib need to format themā€¦I would use the unix epoch time stamp stored in the FW as a uint32_t

typedef struct {
uint8|16_t major;
uint8|16_t minor;
uint16_t rev;
uint16_t build;
uint32_t timestamp;
} fw_version_t;

80 - 96 bits total.

1 Like

thanks for the tutorial, I really want to update my sparkcore since I am on V1 and having some troubles that V2 promises to help.
I am not able to reproduce your steps, what am i doing this wrong? besides using a win7 machine most of the links are all about linux. :frowning: sorry, probably should get a linux box for this i know.
but after I was able to get the dfu drivers installed:
http://sourceforge.net/projects/libwdi/files/zadig/

and the windows DFU loaded.

http://dfu-util.gnumonks.org/releases/dfu-util-0.6-win32.zip

now the list command sees two ā€œdevicesā€

Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=1, name=ā€œUNDEFINEDā€

so I think (cool itā€™s working) but back up command was not working, mostly I get:

Filter on vendor = 0x1d50 product = 0x607f
Opening DFU capable USB deviceā€¦ Cannot open device

so I figure what the heck and tried the load command and got this response:

Error: Invalid dfuse address: 0x00020000:leave

hopefully this is a simple noob mistake ,I am trying to follow your directions but not doing so hot. any advice , or link to reading material is appreciated.

1 Like

Ahā€¦ I made the steps as simple as possible to follow. Maybe I should clarify further in the tutorial.

Did you happen to change the driver for spark core to become dfu driver?

You donā€™t need a linux box for sure. Iā€™m working in windows and will be able to help :slight_smile:

I just did some factory firmware changed for testing last night so shouldnā€™t be a problem with the tutorial commands

Awesome, so close! Grab the 0.7 windows binary here: http://dfu-util.gnumonks.org/releases/dfu-util-0.7-binaries.7z

The older versions don't understand the :leave syntax on the address.

Thanks!
David

@kennethlimcp you know what they say ā€œitā€™s hard to make things idiot proof since idiots figure out new ways to break things every day.ā€ :slight_smile:
Since this is my 1st micro controller I did not have any of the prerequisites installed on my machine, this picture might help explicitly point out what a noob should look for. (I thinkā€¦OR it will help you see something else I have set up wrong)

@Dave, thanks for the link to the utility, now I am getting new results.
the back up command get farther but as they say ā€œclose but no cigarā€.

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=ā€œUNDEFINEDā€
Claiming USB DFU Interfaceā€¦
Cannot claim interface

so who needs a backup anywayā€¦the load command says the same thing.

T:\SPARK-core\dfu07>dfu-util -d 1d50:607f -a 1 -s 0x00020000:leave -D core-firmware.bin
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=ā€œUNDEFINEDā€
Claiming USB DFU Interfaceā€¦
Cannot claim interface
T:\SPARK-core\dfu07>

Should I be getting the 2 devices when I do the list command? does this look right to you?

T:\SPARK-core\dfu07>dfu-util -l
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
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=0, name=ā€œUNDEFINEDā€
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=1, name=ā€œUNDEFINEDā€

Itā€™s technically the core but 2 parts:

Internal flash and external flash.

Make sure the .bin files are at the directory where dfu-util.exe is.

T:\SPARK-core\dfu07 for your case and try again :slight_smile:

Hi @peetersm,

Iā€™m guessing you hit another gotcha on Windows, some operating systems require elevated access to write to devices using something like dfu-util. Try running that process in an Administrator Command Prompt, and maybe thatā€™ll fix it? :smile:

Thanks,
David

thanks for the continued help. I do have the files in the same directory (thanks for checking), and even when running CMD as admin I am getting the ā€œcan not claim interfaceā€.
I am trying to do some reading seems like this error means dfu might be seeing more than one interface. But not sure since dfu only reports is a single interface:

T:\SPARK-core\dfu07>dfu-util.exe -l
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
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=1, name="UNDEFINED"
T:\SPARK-core\dfu07>

@peetersm,

Itā€™s right to show up ā€˜2 devicesā€™ . You can see the alt= thereā€™s 0 and 1. Same device (spark core) but 2 alternatives :smile:

0 for Internal flash and 1 for External flash.

Got some free time? We can try to fix this over chat and post the solution here :wink:

1 Like

I am all set up, had the wrong DFU driver. thanks to @kennethlimcp I am now on V2.
once I got the right version to reinstall the DFU driver for windows
http://zadig.akeo.ie/

It was like night and day. thanks again!!!

1 Like