Flashing a Spark Core you bought elsewhere or in case of emergency


Make sure you have the latest version of brewpi-script (by running the updater or a git pull in the script directory.

Also install dfu-util: sudo apt-get update; sudo apt-get install dfu-util


Hi again,

Finally firmware is updated in spark core, i got brewpi latest version but still no communication between spark core and raspberry pi. Keep saying at device configuration page (when refreshing device list): error while receiving device configuration: Syntax error: JS0N Parse error: Unexpected identifier "could!
To mention that spark core reads the 2 sensors and the switchers. I can also on touch screen switch on and off heater and cooler from fridge


That error is because the script is not running or at least your browser cannot connect to it. Check the logs why.


You are right. Script is not running but doesn´t let me set on the script... even bottom script does not show any letter in it.

log stderr and log stdout are empty


here is how it looks like the screen


Hmm that looks messed up.
Can you hard reset the web interface code so we are sure there are no custom modifications messing this up?

In /var/www/html run:

git checkout master
git reset --hard
git pull

If it is a permissions issue it can be fixed running:

sudo bash /home/brewpi/utils/fixPermissions.sh


uffff.... this is getting hard...)))
check out master returns up-to-date
git reset hard returns: fatal: ambiguous argument ´hard´: unknown revision or path not in the working tree
doing git reset --hard returns: HEAD is now at a5a7908 Merge branch ´release/0.5.0´
git pull returns: already up.to-date

sudo bash returns: bash: /home/brewpi/fixPermissions.sh: file does not exist


I fixed my original instructions. I'm typing this from a camp site in France, so cannot really check or test what I write.


Hi Elco,

I will wait then for your coming back. Thanks a lot for your help


Hey Elco,
I just followed the wiki and used the hypriot image and followed the wiki to update the BrewPi Spark firmware. But, here's the output I get when I do this:

HypriotOS/armv6: pirate@black-pearl in ~
$ docker run -it --name brewpi-dfu --privileged -v ~/brewpi-data:/data --rm brewpi/brewpi-raspbian python utils/flashDfu.py --tag=0.5.3 --noreset
Persistent files already present
Will try to download release '0.5.3'
dfu-util version 0.8 found installed on system.
Detecting DFU devices
Found 1 devices: ['2b04:d006']
Device identified as Particle Photon
Downloading release 0.5.3
tag '0.5.3' not found
Traceback (most recent call last):
File "utils/flashDfu.py", line 264, in
binFile = releases.getBin(tag, [device_type, 'brewpi', '.bin'])
File "/home/brewpi/utils/gitHubReleases.py", line 88, in getBin
downloadUrl = self.getBinUrl(tag, wordsInFileName)
File "/home/brewpi/utils/gitHubReleases.py", line 69, in getBinUrl
AllUrls = (asset["browser_download_url"] for asset in release["assets"])
TypeError: 'NoneType' object has no attribute 'getitem'

Wiki that I used: https://wiki.brewpi.com/getting-started/updating


Try replacing the tag with --tag=0.5.3-rc.2
There has been some work around 0.5.3 recently to fix wifi dropouts. From what I've been reading, rc2 has been more stable.


Perfect! That did the trick there :slight_smile: ! Thanks for the suggestion!


So, back to my original, original issue:

I can't get the script to start running in the web UI. I setup brewpi via the docker and updated the firmware on my Spark. At this point, I'm really not sure where to begin... Here's my only hunch though:

I noticed that in ~/brewpi-data/settings, there's config.cfg.example and defaults.cfg, but no config.cfg. Should I simply edit config.cfg.example or do I have to clone config.cfg.example, rename the clone config.cfg and edit that? Here's what I have in config.cfg.example. The IP address in the 'port' line below is the IP address of my Photon (not my Pi)

======= settings above this line have been added automatically =======

uncomment settings here, these override the settings in defaults.cfg

scriptPath = /home/brewpi/

wwwPath = /var/www/html

port = socket://

altport = /dev/ttyACM1

boardType = p1

startupDelay = 1.0

debug = true

On a standard pi installation, the defaults should work.

If you are using a different linux flavor or Windows, you can set the tool lo$

on Windows, the scripts defaults to an Internet socket instead of a system so$





I believe your correct, copy the config.cfg.example file to config.cfg and reboot


It worked! Yay! Thanks! I wasn't sure if I was gonna, like, break something haha.


@elco I’m trying to upgrade my BrewPi Photon to the latest firmware (v0.5.4). The version I am currently running is v0.4.3. I first set up the Photon using the Particle IOS app on my iPhone so it is connected to my wifi.

I don’t have my Raspberry Pi setup with Docker yet so I’m attempting to use my windows PC to flash the latest firmware with dfu-util for windows. I downloaded the 2 system files and am trying to flash those first (starting with part1). Can you see any obvious errors:



Can you try to run our flashDfu script instead? You should be able to do that from your current brewpi server, but update it first.

Or if you plan to use docker eventually, it will be easier to set that up first and then use it to update the photon.


My Raspberry Pi is currently configured for the legacy branch with Rasbian. I want to set up the container to communicate via WiFi. Will I be able to update from 0.4.3 to 0.5.4 if set up for WiFi?


You can temporarily checkout a different branch than legacy to update your photon. Afterwards you can checkout legacy again.
Run our update script and check out master instead of legacy. Then update your photon with flashDfu.py.

If the update doesn’t work directly 0.4.3 -> 0.5.4, try updating to 0.5.2 first.
sudo python flashDfu.py --autodfu --tag=0.5.2