Tagware
(David Vincent)
2
Okay, I think I finally got to the bottom of this.
It seems that the /boot/config.txt was set to “enable_uart=0” which is why the first issue of ‘ttyAMA0’ no such file was reported.
Change this to read “enable_uart=1” and a reboot of the Raspberry Pi Zero got the /dev folder with ttyAMA0 inside off it. Cross my heart etc etc… I didn’t touch this file. So, how it became changed I do not know? I then using the Admin Page uploaded the emonPI to ttyAMA0 as it was now listed. It took a couple attempts as listed here;
Starting update via service-runner-update.sh (v3.0) >
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 2.9G 11G 21% /
devtmpfs 183M 0 183M 0% /dev
tmpfs 216M 0 216M 0% /dev/shm
tmpfs 216M 3.2M 212M 2% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 216M 0 216M 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 48M 205M 19% /boot
log2ram 50M 4.6M 46M 10% /var/log
tmpfs 44M 0 44M 0% /run/user/1000
tmpfs 44M 0 44M 0% /run/user/118
- emonSD version: emonSD-02Oct19
- supported images: emonSD-08May21 emonSD-24Jul20 emonSD-02Oct19 emonSD-17Oct19
- emonSD base image check passed...continue update
git pull /opt/openenergymonitor/EmonScripts
master
* stable
On branch stable
Your branch is up to date with 'origin/stable'.
nothing to commit, working tree clean
Already up to date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Wed 9 Jun 17:16:47 BST 2021
EUID: 1000
openenergymonitor_dir: /opt/openenergymonitor
type: firmware
firmware: emonpi
Reading package lists...
Building dependency tree...
Reading state information...
python3-pip is already the newest version (18.1-5+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: redis in /usr/local/lib/python3.7/dist-packages (3.5.3)
Hardware detected: rfm2pi
-------------------------------------------------------------
EmonPi Firmware Update (Discrete Sampling)
-------------------------------------------------------------
Start ATmega328 serial upload using avrdude with latest.hex
Attempt: 1
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex
Note: progress written to logfile /var/log/emoncms/firmware.log
avrdude-original: Using autoreset DTR on GPIO Pin 7
strace: |autoreset: Broken pipe
ERROR: Not in sync
Attempt: 2
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex
Note: progress written to logfile /var/log/emoncms/firmware.log
avrdude-original: Using autoreset DTR on GPIO Pin 7
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
avrdude-original: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude-original: Device signature = 0x1e950f (probably m328p)
avrdude-original: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude-original: erasing chip
avrdude-original: reading input file "/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex"
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: writing flash (18526 bytes):
Writing | ################################################## | 100% 2.72s
avrdude-original: 18526 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: load data flash data from input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex contains 18526 bytes
avrdude-original: reading on-chip flash data:
Reading | ################################################## | 100% 2.84s
avrdude-original: verifying ...
avrdude-original: 18526 bytes of flash verified
avrdude-original done. Thank you.
SUCCESS: flash verifed
It now reporting the inputs as it should. :o)
Hope this helps other people. As it had me pulling what hair I have left out. Seems something nasty happen to the Firmware as well as the Uart change in “config.txt”
Can anyone explain why the Firmware is upgraded at 115200 bits when the [Emonhub] config it is listed at 38400 bits/s? Just interested.
Time for a Beer me thinks.
Cheers.
[For future reference, when posting code or output, please put 3 ‘backticks’ (normally found at the top left of the keyboard) on a line of their own *before the code, and 3 more backticks also on a line of their own after the code:
```
code
```
If it is something like php you can add a language identifier after the first 3 backticks: ```php or even ```text if you don’t want any language markup applied.
Thanks - Moderator (RW)]