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

./ in front of a command runs on local files (the . stands for current directory).
In which directory are you running this?
And in which directory are you when running flashDfu.py?

On the pi, if dfu-util is not installed on the path (which is your case), the update script downloads it.
Did you download install our download it manually yourself?

Sorry it’s taken so long. My pi died (at least, I couldn’t log into it, I’ve no idea why), so I’ve installed a new Raspbian, and re-installed the BrewPi software on the Pi. Now I just need to be able to flash the firmware back onto the Spark Core.

I think I’m back to exactly where I was before. ./dfu-util -V returns this:

pi@charlesberg:~ $ ./dfu-util -V
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

when I try to use FlashDfu.py (I got the yellow flashing light), I get this:

pi@charlesberg:~ $ sudo python /home/brewpi/utils/flashDfu.py
Traceback (most recent call last):
File “/home/brewpi/utils/flashDfu.py”, line 153, in
dfuUtilVersion = re.search(’(?<=dfu-util\s)\S*’, output).group()
AttributeError: ‘NoneType’ object has no attribute ‘group’

running ./dfu-util -l returns this:

pi@charlesberg:~ $ ./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: [2b04:d006] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"
Found DFU: [2b04:d006] devnum=0, cfg=1, intf=0, alt=1, name=“UNDEFINED”

AS far as I can see, I’m running dfu-util in the home directory.
I’m also in the home directory when running FlashDfu.py, but I include the full path in the command, as shown above.

I’ve downloaded the scripts from here:
git clone https://github.com/BrewPi/brewpi-tools.git ~/brewpi-tools

Sorry if I’m not making it easy for you to diagnose.

What do you get when you run:
which dfu-util ?
It should return nothing.

And if you run:
dfu-util -V

Instead of:
./dfu-util -V

And finally, if you try:

cd /home/brewpi/utils/
sudo python flashDfu.py 

Indeed - running which dfu-util returned nothing.

duf-util still doesn’t seem to work without the “./” :

pi@charlesberg:~ $ dfu-util -V
bash: dfu-util: command not found

however, after running cd /home/brewpi/utils/ and then
sudo python flashDfu.py, it seems to have come alive!!

Thank you very, very much!

Thanks! That gave the enough info to chase the bug.
So apparently the problem arises when not running flashDfu from its local directory.

For anyone else trying to do this I broke it down Barney style:

cd /home/brewpi/utils
sudo python flashDfu.py

I was sliding my second chamber into place and accidentally bumped the USB cable going from the RPi to the BrewPi Spark, which ended up damaging the USB on the Photon. Fortunately, I keep a stash of Photons around and was able to have my chamber up and running again in just a few minutes. The flashDfu.py worked great.

@Elco did this util get broken along the way? I haven’t dug into it yet but it’s bombing out on me with the below error:

root@raspberrypi:/home/brewpi# python utils/flashDfu.py
Traceback (most recent call last):
File “utils/flashDfu.py”, line 204, in
dfuUtilVersion = re.search(’(?<=dfu-util\s)\S*’, output).group()
AttributeError: ‘NoneType’ object has no attribute 'group’
root@raspberrypi:/home/brewpi

I just decided to upgrade my original CORE to the Photon so trying to do a fresh install.

Cheers,
-Stephen

Very odd but updated dfu-util and all seems to be fine now.

Cheers,
-Stephen

Hi there…
I have my spark that was working normally… Suddenly has no connection with raspberry pi. I can set in DFU mode and raspberry pi see him, but can´t flash a firmware… Just no one method i was reading works for me. Spark is reading the degrees of the 2 sensors and also i can manually switch on or off the heater and the cooler from the fridge.
I was installing new raspberry pi software just in case could help, but didn’t work also.
current firmware version on controller: 0.4.3

if i go into web browser to run brewpi, got stuck waiting for extension uBlock Origin

using:sudo python /home/brewpi/utils/flashDfu.py
returns: AttributeError: ´nonetype´object has no attribute ´group´

using: sudo python updater.py at brewpi-tools directory, returns:
problem flashing file:67 try again

Using other raspberry pi that i have with older system, start brewpi with browser and when refresh device list at device configuration, returns: ERROR WHILE RECEIVING DEVICE CONFIGURATION: SYNTAX ERROR: JS0N PARSE ERROR: UNEXPECTED IDENTIFIER “COULDN”

Any help please???

Thanks

Stephen,
How did you update dfu-util? What commands did you run? It sounds like what you saw here may be similar to my current predicament…

Did you try the docker install procedure described in the wiki? Dfu-util is included in the docker image.

When I enter “docker pull brewpi/brewpi-raspbian” into the command prompt, I get an error message: “bash: docker: command not found”. What am I missing here? If I run “sudo docker pull brewpi/brewpi-raspbian”, I get “sudo: docker: command not found”

Did you follow the instructions on our wiki and used the hypriot image?

Hi Elco,

Did you saw my post? Can you give any advise on how to solve it?

Thanks

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