borpin
(Brian Orpin)
28 January 2023 20:54
4
@glyn.hudson - I think this is one for you. I found this old issue avrdude 6.1 breaking changes · Issue #4 · deanmao/avrdude-rpi · GitHub longer sleep time to work with newer avrdude · mharizanov/avrdude-rpi@4585841 · GitHub . Do you think the sleep time needs tweaking? I’m sure this is the second instance of this being reported.
@brandock - if you want to try and tweak the sleep the script file is in /opt/openenergymonitor/avrdude-rpi
@bwduncan Bruce, I see you did some work round this as well
borpin
(Brian Orpin)
28 January 2023 21:02
5
OK, so interestingly, my git says it is upto date, but there is a new commit to increase the sleep timing modification to support upload on pi4 · mharizanov/avrdude-rpi@27a37ab · GitHub
I may be on the wrong branch on my emonPi.
Sorry scrap that.
On one of the companion forks, the sleep has been increased to 0.35 - see above comit.
borpin
(Brian Orpin)
28 January 2023 21:13
6
@brandock , I don’t think the avrdude-rpi repo is being updated by the update script (need to check). Mine isn’t.
Check you are on the master branch
git status
and if on master
do a
git fetch --all
git pull
[edit]
But you were using a fresh install - so actually can’t be that! Odd
bwduncan
(Bruce)
28 January 2023 21:20
7
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
:) pi@emonpi:~/avrdude-rpi$ ls -l /usr/bin/avrdude*
-rwxr-xr-x 1 root root 383576 Apr 12 2019 /usr/bin/avrdude
-rwxr-xr-x 1 root root 383544 Feb 20 2018 /usr/bin/avrdude-original
:) pi@emonpi:~/avrdude-rpi$
borpin
(Brian Orpin)
28 January 2023 21:23
8
Mine is linked (Old SD image)
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ ls -la /usr/bin/avrd*
lrwxrwxrwx 1 root root 52 Oct 17 2019 /usr/bin/avrdude -> /opt/openenergymonitor/avrdude-rpi/avrdude-autoreset
-rwxr-xr-x 1 root root 383576 Apr 12 2019 /usr/bin/avrdude-original
bwduncan
(Bruce)
28 January 2023 21:25
9
Oh yeah and I just spotted the output of avrdude
which mentions avrdude-original
and the DTR reset
so it must be the right script.
1 Like
brandock
(Brandon Baldock)
28 January 2023 22:47
10
I have another RFM69Pi and I swapped it into place on this emonBase I’m testing with. It worked!
So, it appears there is an issue with the RFM69Pi I was using. It works with emonHub, but not with avrdude.
brandock
(Brandon Baldock)
28 January 2023 23:33
11
Or maybe not?
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 :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x7c
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x65
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x6d
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x6f
Hardware Version: 355084
Firmware Version: 24966696.109388
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x6e
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x42
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x61
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x73
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x65
Vtarget : 34500.4 V
Varef : 52267.6 V
Oscillator : 43.182 Hz
SCK period : 2306464948.0 us
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x5f
avrdude-original: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x72
avrdude-original: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x66
avrdude-original: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude-original: stk500_disable(): protocol error, expect=0x14, 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
avrdude-original: Using autoreset DTR on GPIO Pin 7
ERROR: Not in sync
Restarting EmonHub
brandock
(Brandon Baldock)
29 January 2023 05:15
12
Or maybe so?
Went away for a bit. Came back. Now it worked.
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 :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us
avrdude-original: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude-original: Device signature = 0x1e950f (probably m328p)
avrdude-original: reading input file "/opt/openenergymonitor/data/firmware/emonBase_jeelib.hex"
avrdude-original: writing flash (7814 bytes):
Writing | ################################################## | 100% 2.79s
avrdude-original: 7814 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/data/firmware/emonBase_jeelib.hex:
avrdude-original: load data flash data from input file /opt/openenergymonitor/data/firmware/emonBase_jeelib.hex:
avrdude-original: input file /opt/openenergymonitor/data/firmware/emonBase_jeelib.hex contains 7814 bytes
avrdude-original: reading on-chip flash data:
Reading | ################################################## | 100% 2.48s
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
Restarting EmonHub
borpin
(Brian Orpin)
29 January 2023 09:51
13
This tells me the timing is a bit tight, so works sometimes and not others.
brandock
(Brandon Baldock)
29 January 2023 15:00
14
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.
borpin
(Brian Orpin)
29 January 2023 15:09
15
brandock:
It was set to .32
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.
Follow post #6 Not in Sync Error - RFM69Pi with emonCMS v11.3.0 Admin Firmware Update - #6 by borpin
If you do this, could you post the output from the commands, please?
cd /opt/openenergymonitor/avrdude-rpi
git branch -vvv -a
git show
git fetch --all
git pull
git show
brandock
(Brandon Baldock)
29 January 2023 15:20
16
Here it is for build (1) from above (not a fresh emonSD).
pi@emonpi:/opt/openenergymonitor/data/firmware $ cd /opt/openenergymonitor/avrdude-rpi
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git branch -vvv -a
* master 5c129e2 [origin/master] add module file
remotes/origin/HEAD -> origin/master
remotes/origin/master 5c129e2 add module file
remotes/origin/stable 5c129e2 add module file
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git show
commit 5c129e20fd1c53db5a721511caa508e6e5f43b51 (HEAD -> master, tag: 1.0.0, origin/stable, origin/master, origin/HEAD)
Author: TrystanLea <[email protected] >
Date: Sat May 15 11:35:08 2021 +0100
add module file
diff --git a/module.json b/module.json
new file mode 100644
index 0000000..8cd0c94
--- /dev/null
+++ b/module.json
@@ -0,0 +1,7 @@
+{
+ "name" : "avrdude-rpi",
+ "version" : "1.0.0",
+ "location" : "/opt/openenergymonitor",
+ "branches_available": ["stable","master"],
+ "requires": []
+}
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git fetch --all
Fetching origin
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 34 (delta 20), reused 30 (delta 17), pack-reused 0
Unpacking objects: 100% (34/34), done.
From https://github.com/openenergymonitor/avrdude-rpi
5c129e2..b1dfa07 master -> origin/master
5c129e2..b1dfa07 stable -> origin/stable
* [new tag] 1.0.1 -> 1.0.1
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git pull
Updating 5c129e2..b1dfa07
error: Your local changes to the following files would be overwritten by merge:
autoreset
Please commit your changes or stash them before you merge.
Aborting
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git show
commit 5c129e20fd1c53db5a721511caa508e6e5f43b51 (HEAD -> master, tag: 1.0.0)
Author: TrystanLea <[email protected] >
Date: Sat May 15 11:35:08 2021 +0100
add module file
diff --git a/module.json b/module.json
new file mode 100644
index 0000000..8cd0c94
--- /dev/null
+++ b/module.json
@@ -0,0 +1,7 @@
+{
+ "name" : "avrdude-rpi",
+ "version" : "1.0.0",
+ "location" : "/opt/openenergymonitor",
+ "branches_available": ["stable","master"],
+ "requires": []
+}
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git status
On branch master
Your branch is behind 'origin/master' by 11 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: autoreset
no changes added to commit (use "git add" and/or "git commit -a")
borpin
(Brian Orpin)
29 January 2023 15:22
17
You need to delete your changes
git checkout -- autoreset
git pull
brandock
(Brandon Baldock)
29 January 2023 15:37
18
Here’s the output from the fresh install (build 3 above: emonSD-10Nov22 > update to emonCMS v11.3.0 using the Update tool in emonCMS admin).
pi@emonpi:~ $ cd /opt/openenergymonitor/avrdude-rpi
git branch -vvv -a
git show
git fetch --all
git pull
git show
* master b1dfa07 [origin/master] update version
remotes/origin/HEAD -> origin/master
remotes/origin/master b1dfa07 update version
remotes/origin/stable 5c129e2 add module file
commit b1dfa07a78cafbc2a9dbf30a453d98593ed34367 (HEAD -> master, origin/master, origin/HEAD)
Author: TrystanLea <[email protected] >
Date: Fri Nov 18 17:50:07 2022 +0000
update version
diff --git a/module.json b/module.json
index 8cd0c94..3b6d6aa 100644
--- a/module.json
+++ b/module.json
@@ -1,6 +1,6 @@
{
"name" : "avrdude-rpi",
- "version" : "1.0.0",
+ "version" : "1.0.1",
"location" : "/opt/openenergymonitor",
"branches_available": ["stable","master"],
"requires": []
Fetching origin
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 138 bytes | 11.00 KiB/s, done.
From https://github.com/openenergymonitor/avrdude-rpi
5c129e2..b1dfa07 stable -> origin/stable
* [new tag] 1.0.1 -> 1.0.1
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
commit b1dfa07a78cafbc2a9dbf30a453d98593ed34367 (HEAD -> master, tag: 1.0.1, origin/stable, origin/master, origin/HEAD)
Author: TrystanLea <[email protected] >
Date: Fri Nov 18 17:50:07 2022 +0000
update version
diff --git a/module.json b/module.json
index 8cd0c94..3b6d6aa 100644
--- a/module.json
+++ b/module.json
@@ -1,6 +1,6 @@
{
"name" : "avrdude-rpi",
- "version" : "1.0.0",
+ "version" : "1.0.1",
"location" : "/opt/openenergymonitor",
"branches_available": ["stable","master"],
"requires": []
brandock
(Brandon Baldock)
29 January 2023 15:41
19
And here is the output of those commands for build (1), after first deleting my change to autoreset.
pi@emonpi:~ $ cd /opt/openenergymonitor/avrdude-rpi
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git checkout -- autoreset
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git pull
Updating 5c129e2..b1dfa07
Fast-forward
README.md | 18 ++++++++----------
autoreset | 66 +++++++++++++++++++++++++++++-------------------------------------
install | 6 +-----
module.json | 2 +-
4 files changed, 39 insertions(+), 53 deletions(-)
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git branch -vvv -a
* master b1dfa07 [origin/master] update version
remotes/origin/HEAD -> origin/master
remotes/origin/master b1dfa07 update version
remotes/origin/stable b1dfa07 update version
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git show
commit b1dfa07a78cafbc2a9dbf30a453d98593ed34367 (HEAD -> master, tag: 1.0.1, origin/stable, origin/master, origin/HEAD)
Author: TrystanLea <[email protected] >
Date: Fri Nov 18 17:50:07 2022 +0000
update version
diff --git a/module.json b/module.json
index 8cd0c94..3b6d6aa 100644
--- a/module.json
+++ b/module.json
@@ -1,6 +1,6 @@
{
"name" : "avrdude-rpi",
- "version" : "1.0.0",
+ "version" : "1.0.1",
"location" : "/opt/openenergymonitor",
"branches_available": ["stable","master"],
"requires": []
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git fetch --all
Fetching origin
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git pull
Already up to date.
pi@emonpi:/opt/openenergymonitor/avrdude-rpi $ git show
commit b1dfa07a78cafbc2a9dbf30a453d98593ed34367 (HEAD -> master, tag: 1.0.1, origin/stable, origin/master, origin/HEAD)
Author: TrystanLea <[email protected] >
Date: Fri Nov 18 17:50:07 2022 +0000
update version
diff --git a/module.json b/module.json
index 8cd0c94..3b6d6aa 100644
--- a/module.json
+++ b/module.json
@@ -1,6 +1,6 @@
{
"name" : "avrdude-rpi",
- "version" : "1.0.0",
+ "version" : "1.0.1",
"location" : "/opt/openenergymonitor",
"branches_available": ["stable","master"],
"requires": []
borpin
(Brian Orpin)
29 January 2023 15:42
20
Ok, yes, that is the latest version.
Does it still work though!
brandock
(Brandon Baldock)
29 January 2023 15:49
21
It does. Tried updating firmware several times and it works.
1 Like
borpin
(Brian Orpin)
29 January 2023 15:50
22
Great. the avrdude-rpi
install is not being updated, hence why it was still 0.32s.
borpin
(Brian Orpin)
Split this topic
29 January 2023 17:57
23
A post was split to a new topic: Flash image to Moteino USB device