Update! The latest version includes a script that all the work below for you!
You just have to put your core in DFU mode and run:
sudo python /home/brewpi/utils/flashDfu.py
If you cannot flash via the web interface, because you do not have the BrewPi firmware on the device anymore (no 2 beeps at startup) or in any other emergency case, you can still flash via DFU by booting into the bootloader. Below are instructions on how to do that from the Raspberry Pi. Installing DFU under Linux is much easier than on windows, so below are the few easy steps.
To do this, download a compiled binary of dfu-util (this instruction is for the raspberry pi, if you are not running on a pi, you will need a different version). Do not install it from apt-get, the version on apt is outdated (0.5). After download, change the permissions to allow executing it with chmod:
cd ~
wget http://dfu-util.sourceforge.net/releases/dfu-util-0.7-binaries/linux-armel/dfu-util
sudo chmod 777 dfu-util
Also download the binary to flash to the user’s home directory:
wget https://github.com/BrewPi/firmware/releases/download/0.2.7/brewpi.bin
Put your spark core in DFU mode. This is done by resetting the device while holding the mode button until you see a yellow LED flashing. With the Spark Core being inside the enclosure, this is a bit harder.
There are two holes in the bottom. When looking into the USB connector, the right hole is above the mode button and the left hole is above the reset button.
I find it easiest to hold the mode button down with a pin, while plugging in the USB cable. After 3 seconds, the light should flash. If you hold it for 10 seconds, this will do a factory reset. Don’t do this.
List devices with dfu-util:
sudo ./dfu-util -l
It should show your device:
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"
Now flash brewpi.bin to the spark core, with the following command:
sudo ./dfu-util -d 1d50:607f -a 0 -s 0x08005000:leave -D brewpi.bin
The output should look like this:
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=0, name="@Internal Flash /0x08000000/20*001Ka,108*001Kg"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuDNLOAD-IDLE, status = 0
aborting previous incomplete transfer
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: "Internal Flash "
Downloading to address = 0x08005000, size = 96308
...............................................................................................
File downloaded successfully
Transitioning to dfuMANIFEST state
Error during download get_status
That last error is normal. Your controller should beep and be back with version 0.2.7
After programming, run the following command to load default settings to the controller:
echo -ne 'E\n' > /dev/ttyACM0