I updated to emonCMS stable release v11.3.0 and I am trying to update an RFM69Pi hat to the new LPL firmware using the Admin > Update > Update Firmware Only tool.
I get the programmer not in sync error from avrdude.
I also tried updating my test emonBase to the current emonSD. Same result. The log is pasted here:
LAST ENTRIES ON THE LOG FILE
-------------------------------------------------------------
emonBase_rfm69pi_LPL Firmware Upload
-------------------------------------------------------------
Downloading firmware from:
https://github.com/openenergymonitor/emonBase_rfm69pi_LPL/releases/download/1.0.0/emonBase_rfm69pi_LPL.hex
Downloaded file:
-rw-r--r-- 1 pi pi 28K Nov 18 16:01 /opt/openenergymonitor/data/firmware/emonBase_rfm69pi_LPL.hex
EmonHub is running, stopping EmonHub
Uploading emonBase_rfm69pi_LPL on serial port ttyAMA0
Attempt 1...
avrdude-original: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyAMA0
Using Programmer : arduino
Overriding Baud Rate : 38400
avrdude-original: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0d
avrdude-original: stk500_getsync() attempt 2 of 10: not in sync: resp=0x0a
avrdude-original: stk500_getsync() attempt 3 of 10: not in sync: resp=0x5b
avrdude-original: stk500_getsync() attempt 4 of 10: not in sync: resp=0x52
avrdude-original: stk500_getsync() attempt 5 of 10: not in sync: resp=0x46
avrdude-original: stk500_getsync() attempt 6 of 10: not in sync: resp=0x31
avrdude-original: stk500_getsync() attempt 7 of 10: not in sync: resp=0x32
avrdude-original: stk500_getsync() attempt 8 of 10: not in sync: resp=0x64
avrdude-original: stk500_getsync() attempt 9 of 10: not in sync: resp=0x65
avrdude-original: stk500_getsync() attempt 10 of 10: not in sync: resp=0x6d
avrdude-original done. Thank you.
avrdude-original: Using autoreset DTR on GPIO Pin 7
avrdude-original: Using autoreset DTR on GPIO Pin 7
ERROR: Not in sync
emonSD-21Jul21 > update to emonCMS v11.3.0 using the Update tool in emonCMS admin
emonSD-10Nov22
emonSD-10Nov22 > update to emonCMS v11.3.0 using the Update tool in emonCMS admin
The result is the same.
It also tried running avrdude from the command line (while in the first mode above).
pi@emonpi:/opt/openenergymonitor/EmonScripts/update $ avrdude -carduino -Cavrdude.conf -v -pATMEGA328P -P/dev/ttyAMA0 -b38400 -Uflash:w:/opt/openenergymonitor/data/firmware/emonBase_rfm69pi_LPL.hex:i
avrdude-original: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyAMA0
Using Programmer : arduino
Overriding Baud Rate : 38400
avrdude-original: Using autoreset DTR on GPIO Pin 7
avrdude-original: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0d
avrdude-original: stk500_getsync() attempt 2 of 10: not in sync: resp=0x0a
avrdude-original: stk500_getsync() attempt 3 of 10: not in sync: resp=0x5b
avrdude-original: stk500_getsync() attempt 4 of 10: not in sync: resp=0x52
avrdude-original: stk500_getsync() attempt 5 of 10: not in sync: resp=0x46
avrdude-original: stk500_getsync() attempt 6 of 10: not in sync: resp=0x31
avrdude-original: stk500_getsync() attempt 7 of 10: not in sync: resp=0x32
avrdude-original: stk500_getsync() attempt 8 of 10: not in sync: resp=0x64
avrdude-original: stk500_getsync() attempt 9 of 10: not in sync: resp=0x65
avrdude-original: stk500_getsync() attempt 10 of 10: not in sync: resp=0x6d
avrdude-original done. Thank you.
strace: |autoreset: Broken pipe
I have seen this error before I made my changes to the code, but I never got to the bottom of why it doesn’t reset the microcontroller properly.
I noticed on my emonpi the avrdude in the $PATH is not the one which can autoreset the µc [1]. It looks like it was never installed. You might need to run the install script in the avrdude-rpi repository manually before running avrdude
Bruce
[1] avrdude in /usr/bin is not a symlink to /home/pi/avrdude/avrdude-autoreset as would be expected if the install script had been run
I was able to update that RFM69Pi to use LPL firmware. But when I try to make subsequent updates they fail.
LAST ENTRIES ON THE LOG FILE
-------------------------------------------------------------
emonBase_jeelib Firmware Upload
-------------------------------------------------------------
Downloading firmware from:
https://github.com/openenergymonitor/RFM2Pi/releases/download/1.4.0/firmware.hex
Downloaded file:
-rw-r--r-- 1 pi pi 22K Dec 7 2021 /opt/openenergymonitor/data/firmware/emonBase_jeelib.hex
EmonHub is running, stopping EmonHub
Uploading emonBase_jeelib on serial port ttyAMA0
Attempt 1...
avrdude-original: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyAMA0
Using Programmer : arduino
Overriding Baud Rate : 38400
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
avrdude-original: Using autoreset DTR on GPIO Pin 7
avrdude-original: Using autoreset DTR on GPIO Pin 7
avrdude-original: Using autoreset DTR on GPIO Pin 7
ERROR: Not in sync
LAST ENTRIES ON THE LOG FILE
-------------------------------------------------------------
emonBase_jeelib Firmware Upload
-------------------------------------------------------------
Downloading firmware from:
https://github.com/openenergymonitor/RFM2Pi/releases/download/1.4.0/firmware.hex
Downloaded file:
-rw-r--r-- 1 pi pi 22K Dec 7 2021 /opt/openenergymonitor/data/firmware/emonBase_jeelib.hex
EmonHub is running, stopping EmonHub
Uploading emonBase_jeelib on serial port ttyAMA0
Attempt 1...
avrdude-original: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyAMA0
Using Programmer : arduino
Overriding Baud Rate : 38400
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
avrdude-original: verifying ...
avrdude-original: 7814 bytes of flash verified
avrdude-original done. Thank you.
avrdude-original: Using autoreset DTR on GPIO Pin 7
avrdude-original: Using autoreset DTR on GPIO Pin 7
avrdude-original: Using autoreset DTR on GPIO Pin 7
SUCCESS: flash verifed
That makes sense. So I read your replies above more carefully and checked the time.sleep setting in /opt/openenergymonitor/avrdude-rpi/autoreset
It was set to .32 (in my SD card listed in build (1) above). I changed it to .35 and have not seen a failure since. I switched back and forth between LPL and JeeLib firmware five or six times without any issues.
Ok, so the repo probably has not been updated correctly then, as the latest version is 0.35s and has some other changes. I’m not sure why the version number is right though in the modules summary.