Flashing Part 2 Fail

Hi, could use a little help with a firmware update problem.
The output below is from a new clean install of brewpi on a raspberry pi 3 and new / never used spark v2

The update seems to download and install part 1 ok and then ‘hangs’ sending the first byte of part 2.

Thanks in advance for any assistance.

Greg

brewpi@rasp-pi3:~/utils$ python updateFirmware.py
Stopping any running instances of BrewPi to check/update controller…

Checking current firmware version…
Jul 05 2018 11:35:28 Background thread for serial started
Jul 05 2018 11:35:28 Serial (re)connected for Photon with WiFi [00000000050C] at port: ttyACM0
Jul 05 2018 11:35:30 Background thread for serial stopped
Current firmware version on controller: 0.4.3

Checking GitHub for available release…

Available releases:

[0] 0.5.5
[1] 0.5.2
[2] 0.5.1
[3] 0.5.0
[4] 0.4.4
[5] 0.4.3
[6] 0.4.2
[7] 0.4.1
[8] 0.4.0
[9] 0.2.11
[10] Cancel firmware update
Enter the number [0-10] of the version you want to program [default = 0 (0.5.5)] : 0
Would you like me to try to restore you settings after programming? [Y/n]:
n
Would you like me to try to restore your configured devices after programming? [Y/n]:
n
Downloading firmware…
downloading https://github.com/BrewPi/firmware/releases/download/0.5.5/brewpi-ph oton-0.5.5.bin
Updated system firmware for the photon found in release 0.5.5
downloading https://github.com/BrewPi/firmware/releases/download/0.5.5/system-pa rt1-0.8.0-rc.3-photon.bin
downloading https://github.com/BrewPi/firmware/releases/download/0.5.5/system-pa rt2-0.8.0-rc.3-photon.bin
Downloaded new system firmware to:

/home/brewpi/utils/downloads/0.5.5/system-part1-0.8.0-rc.3-photon.bin
and

/home/brewpi/utils/downloads/0.5.5/system-part2-0.8.0-rc.3-photon.bin

Latest firmware downloaded to:
/home/brewpi/utils/downloads/0.5.5/brewpi-photon-0.5.5.bin

Updating firmware…

**** Photon Program script started ****
Settings will not be restored
Devices will not be restored
Jul 05 2018 11:35:55 Background thread for serial started
Jul 05 2018 11:35:55 Background thread for serial stopped
Jul 05 2018 11:35:55 Opening serial port
Flashing system part 1.
Triggering a firmware update with the ymodem protocol on the controller
Flashing file /home/brewpi/utils/downloads/0.5.5/system-part1-0.8.0-rc.3-photon. bin
File flashed successfully
Waiting 15 seconds for device to reset and come back as serial port.
15/15
Jul 05 2018 12:07:39 Opening serial port
Flashing system part 2.
Triggering a firmware update with the ymodem protocol on the controller
Flashing file /home/brewpi/utils/downloads/0.5.5/system-part2-0.8.0-rc.3-photon. bin
Traceback (most recent call last):
File “updateFirmware.py”, line 265, in
result = updateFromGitHub(userInput=userInput, beta=beta, useDfu=useDfu)
File “updateFirmware.py”, line 236, in updateFromGitHub
{‘settings’: restoreSettings, ‘devices’: restoreDevices})
File “/home/brewpi/utils/…/programController.py”, line 169, in programControl ler
return programmer.program(hexFile, system1File, system2File, useDfu, restore What)
File “/home/brewpi/utils/…/programController.py”, line 261, in program
if not self.flash_file(system2File):
File “/home/brewpi/utils/…/programController.py”, line 578, in flash_file
result = LightYModem().transfer(file, self.ser, stderr)
File “/home/brewpi/utils/…/programController.py”, line 155, in transfer
response = self.send_packet(binFile, output)
File “/home/brewpi/utils/…/programController.py”, line 130, in send_packet
response = self._send_ymodem_packet(data) # resend requested
File “/home/brewpi/utils/…/programController.py”, line 109, in _send_ymodem_p acket
response = self._read_response()
File “/home/brewpi/utils/…/programController.py”, line 87, in _read_response
ch1 = self.ymodem.read(1)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 501, in read
'device reports readiness to read but returned no data ’
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
brewpi@rasp-pi3:~/utils$

Can you try using flashDfu.py instead?
Use the flag - - autodfu to automatically reboot in Dfu mode.

I also recommend reinstalling the pi using docker as described on our wiki.

Thanks for the help Elco.

Tried your flashDfu suggestion without success.
Results below.

I have two spark photons and two pi3 with updates that behave the same.
I shall do some more reading on the Particle stuff and also try your second suggestion

Thanks again.
Greg

brewpi@rasp-pi3:~/utils$ python flashDfu.py --autodfu
Will automatically reboot newly detected photons into DFU mode
Using dfu-util binary at downloads/dfu-util
WARNING: It is not possible to update the bootloader with DFU. If the new release requires an updated bootloader, the photon will automatically download it from the Particle cloud.
This does require a WiFi connection on the Photon.
If the photon does not have WiFi credentials, it will start in listening mode (blinking blue).
Please use the Particle phone app to set up WiFi. Your photon will hang in safe mode until the bootloader is updated from the cloud.
If the photon has invalid WiFi credentials, it will hang blinking green. Hold the setup button for 5 seconds to trigger listening mode.

Detecting DFU devices
Did not find any DFU devices.
Is your Photon or Spark Core running in DFU mode (blinking yellow)?
Waiting until a DFU device is connected…
Found new serial port connected: /dev/ttyACM0 - Photon with WiFi
Putting Particle Photon in DFU mode
Found 1 devices: [‘2b04:d006’]
Device identified as Particle Photon
Downloading latest firmware…
Latest stable version on GitHub for photon: 0.5.5
downloading https://github.com/BrewPi/firmware/releases/download/0.5.5/brewpi-photon-0.5.5.bin
Firmware downloaded to /home/brewpi/utils/downloads/0.5.5/brewpi-photon-0.5.5.bin
Updated system firmware for the photon found in release 0.5.5
downloading https://github.com/BrewPi/firmware/releases/download/0.5.5/system-part1-0.8.0-rc.3-photon.bin
downloading https://github.com/BrewPi/firmware/releases/download/0.5.5/system-part2-0.8.0-rc.3-photon.bin
Downloaded new system firmware to:

/home/brewpi/utils/downloads/0.5.5/system-part1-0.8.0-rc.3-photon.bin and

/home/brewpi/utils/downloads/0.5.5/system-part2-0.8.0-rc.3-photon.bin

Updating system firmware for the photon, part 1: /home/brewpi/utils/downloads/0.5.5/system-part1-0.8.0-rc.3-photon.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 = 0x2b04 product = 0xd006
Cannot open device
Opening DFU capable USB device… Updating system firmware for the photon, part 2: /home/brewpi/utils/downloads/0.5.5/system-part2-0.8.0-rc.3-photon.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 = 0x2b04 product = 0xd006
Cannot open device
Opening DFU capable USB device… Now writing BrewPi firmware /home/brewpi/utils/downloads/0.5.5/brewpi-photon-0.5.5.bin to photon
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 = 0x2b04 product = 0xd006
Cannot open device
Opening DFU capable USB device… Programming done
Now resetting EEPROM to defaults
Press Enter to continue…
Opening serial port to reset factory defaults
Jul 06 2018 07:30:48 Opening serial port
Jul 06 2018 07:30:58 Errors while opening serial port:
Could not find compatible serial devices

Jul 06 2018 07:30:59 Opening serial port
Jul 06 2018 07:31:09 Errors while opening serial port:
Could not find compatible serial devices

Jul 06 2018 07:31:10 Opening serial port
Jul 06 2018 07:31:21 Errors while opening serial port:
Could not find compatible serial devices

Jul 06 2018 07:31:22 Opening serial port
Jul 06 2018 07:31:32 Errors while opening serial port:
Could not find compatible serial devices

Jul 06 2018 07:31:33 Opening serial port
Jul 06 2018 07:31:43 Errors while opening serial port:
Could not find compatible serial devices

Jul 06 2018 07:31:44 Opening serial port
Jul 06 2018 07:31:54 Errors while opening serial port:
Could not find compatible serial devices

Jul 06 2018 07:31:55 Opening serial port
^CTraceback (most recent call last):
File “flashDfu.py”, line 344, in
if not programmer.open_serial_with_retry(config_copy, 57600, 1):
File “/home/brewpi/utils/…/programController.py”, line 364, in open_serial_with_retry
if self.open_serial(config, baud, timeout):
File “/home/brewpi/utils/…/programController.py”, line 335, in open_serial
self.ser = util.setupSerial(config, baud, timeout)
File “/home/brewpi/utils/…/BrewPiUtil.py”, line 135, in setupSerial
time.sleep(1)
KeyboardInterrupt
brewpi@rasp-pi3:~/utils$

Did some more reading and problem is now resolved.

All I needed to do was prefix Elco’s first suggestion with ‘sudo’

Now have a flashing blue led… listening mode.
Best download the app:smiley:

Great, once you set up WiFi, it will update the bootloader from the cloud.

I would still switch to a docker setup though.