emonPi not seemingly automatically seeing Tx4 with 12 CT firmware

I’ve just upgraded my emonPi to using a newer base image (1st Feb 2024; from October 2019), and switched the firmware from JeeLib to LowPowerLabs. All the OEM related software is up to date.

Following Should I update Emon Pi firmware to CM, and how? it all went pretty smooth. Yay.

Similarly, so did updating the firmware on the TH2, having bought the programmer previously.

I enabled autoconf as is suggested.

Which then brings me round to the Tx4 which I’d never put into production. It was originally shipped (in June 2023) with the JeeLib firmware, so it needed updating to match the update on the emonPi, but I’ve also put the CT expander in it, before putting it into use.

I intend to use it wirelessly with the emonPi.

I flashed the relevant firmware (emonTx4_DB_12CT_1phase_LPL), but it doesn’t seem to be found automagically by the emonPi. There’s no red LED flashing/briefly on startup/power plug in on that firmware (there is on the 6CT firmware). I’m not sure if that’s expected, or relevant.

If I flash back to the 6CT firmware, emon_DB_6CT_1phase_27 appears in the inputs automatically, and all seems to be playing nice. Plus the red LED comes on for a few seconds after power on.

6 CT Expansion board — OpenEnergyMonitor 0.0.1 documentation seems to suggest that autoconf should work:

If you have the latest version of emonhub with autoconf enabled, it will automatically populate the node decoder configuration below.

I have tried adding the manual config as it’s mentioned, and then saving, rebooting EmonHub, and even the whole emonPi, to no apparent avail.

I haven’t tried the Tx4 plugged into the emonPi for anything other than firmware yet, so I guess I should do that (though the config change potentially conflicts with the existing config for the monitoring equipment in the emonPi itself), and also see if I can get the serial console as suggested under emonTx4, emonVs & emonBase Install Guide — OpenEnergyMonitor 0.0.1 documentation

I do note that on the page it does say

  • Switch on mains socket and verify that the red LED on the emonTx4 and the red LED on the Raspberry Pi illuminates.

So it kinda seems that my theory that something is wrong with the firmware/the flash, may indeed be the case…

The flash log for the 12CT has some noise (but so does the 6CT), which I don’t know if it is relevant.

12CT:

LAST ENTRIES ON THE LOG FILE
-------------------------------------------------------------
Firmware selected: emonTx4_DB_12CT_1phase_LPL
-------------------------------------------------------------
Downloading firmware from:
https://raw.githubusercontent.com/openenergymonitor/avrdb_firmware/master/compiled/emonTx4/emonTx4_DB_12CT_1phase_LPL_v1_2_0.ino.hex

Downloaded file:
-rw-r--r-- 1 pi pi 66K Jun 16 17:49 /opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex

EmonHub is running, stopping EmonHub

Uploading emonTx4_DB_12CT_1phase_LPL on serial port ttyUSB0
Attempt 1...

avrdude -Cavrdude.conf -v -pavr128db48 -carduino -D -P/dev/ttyUSB0 -b115200 -Uflash:w:/opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex:i

avrdude-original: Version 7.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

System wide configuration file is /opt/openenergymonitor/EmonScripts/update/avrdude.conf
avrdude-original yywarning() warning: ATmega329's flash writepage misses a necessary address bit a13 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:5932]
avrdude-original yywarning() warning: ATmega649's flash writepage misses a necessary address bit a14 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:6158]
avrdude-original yywarning() warning: AT90PWM2's eeprom writepage misses a necessary address bit a8 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:9348]
avrdude-original yywarning() warning: ATtiny44's eeprom writepage misses a necessary address bit a7 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11206]
avrdude-original yywarning() warning: ATtiny84's eeprom writepage misses a necessary address bit a8 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11390]
avrdude-original yywarning() warning: a4 would normally be expected to be a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a3 would normally be expected to be a4 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a2 would normally be expected to be a3 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a1 would normally be expected to be a2 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a0 would normally be expected to be a1 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: too few opcode bits in instruction [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: ATtiny43u's eeprom read misses a necessary address bit a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11694]
avrdude-original yywarning() warning: ATmega32U4's eeprom writepage misses a necessary address bit a2 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11880]
avrdude-original yywarning() warning: AT90USB1286's eeprom writepage misses a necessary address bit a11 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:12275]
avrdude-original yywarning() warning: ATtiny1634's flash writepage misses a necessary address bit a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:15031]
avrdude-original yywarning() warning: mcuid -1 for ATtiny402w is out of range [0..2039], use a free number >= 372 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:15497]
User configuration file is /root/.avrduderc
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : AVR128DB48
RESET disposition : dedicated
RETRY pulse : SCK
Serial program mode : yes
Parallel program mode : yes
Memory Detail :

Block Poll Page Polled
Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 1 0 0 0 0x00 0x00
prodsig 0 0 0 0 no 125 125 0 0 0 0x00 0x00
fuses 0 0 0 0 no 9 16 0 0 0 0x00 0x00
fuse0 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse1 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse2 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse4 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse5 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse6 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse7 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse8 0 0 0 0 no 1 1 0 0 0 0x00 0x00
lock 0 0 0 0 no 4 1 0 0 0 0x00 0x00
data 0 0 0 0 no 0 1 0 0 0 0x00 0x00
flash 0 0 0 0 no 131072 512 0 0 0 0x00 0x00
eeprom 0 0 0 0 no 512 32 0 0 0 0x00 0x00

Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 25.1

avrdude-original: AVR device initialized and ready to accept instructions
avrdude-original: device signature = 0x1e970c (probably avr128db48)
avrdude-original: reading input file /opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex for flash
with 23896 bytes in 1 section within [0x200, 0x5f57]
using 47 pages and 168 pad bytes
avrdude-original: writing 23896 bytes flash ...

Writing | ################################################## | 100% 3.64s

avrdude-original: 23896 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex

Reading | ################################################## | 100% 2.40s

avrdude-original: 23896 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

6CT:

LAST ENTRIES ON THE LOG FILE
-------------------------------------------------------------
Firmware selected: emonTx4_DB_6CT_1phase_LPL
-------------------------------------------------------------
Downloading firmware from:
https://raw.githubusercontent.com/openenergymonitor/avrdb_firmware/master/compiled/emonTx4/emonTx4_DB_6CT_1phase_LPL_v2_1_0.ino.hex

Downloaded file:
-rw-r--r-- 1 pi pi 71K Jun 16 18:37 /opt/openenergymonitor/data/firmware/emonTx4_DB_6CT_1phase_LPL.hex

EmonHub is running, stopping EmonHub

Uploading emonTx4_DB_6CT_1phase_LPL on serial port ttyUSB0
Attempt 1...

avrdude -Cavrdude.conf -v -pavr128db48 -carduino -D -P/dev/ttyUSB0 -b115200 -Uflash:w:/opt/openenergymonitor/data/firmware/emonTx4_DB_6CT_1phase_LPL.hex:i

avrdude-original: Version 7.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

System wide configuration file is /opt/openenergymonitor/EmonScripts/update/avrdude.conf
avrdude-original yywarning() warning: ATmega329's flash writepage misses a necessary address bit a13 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:5932]
avrdude-original yywarning() warning: ATmega649's flash writepage misses a necessary address bit a14 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:6158]
avrdude-original yywarning() warning: AT90PWM2's eeprom writepage misses a necessary address bit a8 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:9348]
avrdude-original yywarning() warning: ATtiny44's eeprom writepage misses a necessary address bit a7 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11206]
avrdude-original yywarning() warning: ATtiny84's eeprom writepage misses a necessary address bit a8 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11390]
avrdude-original yywarning() warning: a4 would normally be expected to be a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a3 would normally be expected to be a4 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a2 would normally be expected to be a3 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a1 would normally be expected to be a2 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a0 would normally be expected to be a1 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: too few opcode bits in instruction [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: ATtiny43u's eeprom read misses a necessary address bit a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11694]
avrdude-original yywarning() warning: ATmega32U4's eeprom writepage misses a necessary address bit a2 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11880]
avrdude-original yywarning() warning: AT90USB1286's eeprom writepage misses a necessary address bit a11 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:12275]
avrdude-original yywarning() warning: ATtiny1634's flash writepage misses a necessary address bit a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:15031]
avrdude-original yywarning() warning: mcuid -1 for ATtiny402w is out of range [0..2039], use a free number >= 372 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:15497]
User configuration file is /root/.avrduderc
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : AVR128DB48
RESET disposition : dedicated
RETRY pulse : SCK
Serial program mode : yes
Parallel program mode : yes
Memory Detail :

Block Poll Page Polled
Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 1 0 0 0 0x00 0x00
prodsig 0 0 0 0 no 125 125 0 0 0 0x00 0x00
fuses 0 0 0 0 no 9 16 0 0 0 0x00 0x00
fuse0 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse1 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse2 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse4 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse5 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse6 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse7 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse8 0 0 0 0 no 1 1 0 0 0 0x00 0x00
lock 0 0 0 0 no 4 1 0 0 0 0x00 0x00
data 0 0 0 0 no 0 1 0 0 0 0x00 0x00
flash 0 0 0 0 no 131072 512 0 0 0 0x00 0x00
eeprom 0 0 0 0 no 512 32 0 0 0 0x00 0x00

Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 25.1

avrdude-original: AVR device initialized and ready to accept instructions
avrdude-original: device signature = 0x1e970c (probably avr128db48)
avrdude-original: reading input file /opt/openenergymonitor/data/firmware/emonTx4_DB_6CT_1phase_LPL.hex for flash
with 25590 bytes in 1 section within [0x200, 0x65f5]
using 50 pages and 10 pad bytes
avrdude-original: writing 25590 bytes flash ...

Writing | ################################################## | 100% 3.87s

avrdude-original: 25590 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/data/firmware/emonTx4_DB_6CT_1phase_LPL.hex

Reading | ################################################## | 100% 2.56s

avrdude-original: 25590 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

It seems the web serial can talk to it ok…

firmware = emon_DB_12CT
version = 1.2.0
hardware = voltage = 1phase
No EEPROM config
vCal = 101.30
iCal1 = 20.00, iLead1 = 3.20
iCal2 = 20.00, iLead2 = 3.20
iCal3 = 20.00, iLead3 = 3.20
iCal4 = 20.00, iLead4 = 3.20
iCal5 = 20.00, iLead5 = 3.20
iCal6 = 20.00, iLead6 = 3.20
iCal7 = 20.00, iLead7 = 3.20
iCal8 = 20.00, iLead8 = 3.20
iCal9 = 20.00, iLead9 = 3.20
iCal10 = 20.00, iLead10 = 3.20
iCal11 = 20.00, iLead11 = 3.20
iCal12 = 20.00, iLead12 = 3.20
pulse = off
RF = on, rfBand = 433 MHz, rfGroup = 210, rfNode = 28, rfPower = 25, rfFormat = datalog = 9.80
json = off

The 6CT config from the serial doesn’t look dissimilar…

firmware = emon_DB_6CT
version = 2.1.0
hardware = emonTx4
voltage = 1phase
No EEPROM config
vCal = 101.30
iCal1 = 100.00, iLead1 = 3.20
iCal2 = 50.00, iLead2 = 3.20
iCal3 = 50.00, iLead3 = 3.20
iCal4 = 20.00, iLead4 = 3.20
iCal5 = 20.00, iLead5 = 3.20
iCal6 = 20.00, iLead6 = 3.20
pulse = 1, pulsePeriod = 100ms
RF = on, rfBand = 433 MHz, rfGroup = 210, rfNode = 27, rfPower = 25, rfFormat = LowPowerLabs
datalog = 9.80
json = off
vrefa = 1.0306

However, I do see on the 6CT:

hardware = emonTx4
voltage = 1phase

vs on the 12CT:

hardware = voltage = 1phase

Is the 12CT missing a value for the hardware?

Similar for the rfFormat?

6CT:

rfFormat = LowPowerLabs
datalog = 9.80

12CT:

rfFormat = datalog = 9.80

Seems to be missing a value, and a newline…

Looking at avrdb_firmware/emon_DB_12CT/emon_DB_12CT.ino at master · openenergymonitor/avrdb_firmware · GitHub

void print_firmware_version() {

  Serial.println(F("firmware = emon_DB_12CT"));
  Serial.print(F("version = "));
  Serial.write(firmware_version);

  Serial.print(F("hardware = "));

#ifdef EMONTX4
  Serial.println(F("emonTx4"));
#endif
#ifdef EMONPI2
  Serial.println(F("emonPi2"));
#endif
#ifdef EMONTX5
  Serial.println(F("emonTx5"));
#endif
  Serial.print(F("voltage = "));

  Serial.print(NUM_V_CHANNELS);
  Serial.println(F("phase"));
}

Was a flag (to set EMONTX4) missed on the build/compliation of the firmware? As that would explain no output for the value.

Similar for the rfFormat:

void print_radio_setting() {
  if (EEProm.rf_on) {
    Serial.print(F("RF = on, rfBand = ")); 
    Serial.print(EEProm.RF_freq == RF69_433MHZ ? 433 : 
                 EEProm.RF_freq == RF69_868MHZ ? 868 :
                 EEProm.RF_freq == RF69_915MHZ ? 915 : 0);
    Serial.print(F(" MHz, rfGroup = ")); Serial.print(EEProm.networkGroup);
    Serial.print(F(", rfNode = ")); Serial.print(EEProm.nodeID & 0x3F);
    Serial.print(F(", rfPower = ")); Serial.print(EEProm.rfPower);

    Serial.print(F(", rfFormat = "));
    #ifdef RFM69_LOW_POWER_LABS
      Serial.println(F("LowPowerLabs"));
    #elif defined(RFM69_JEELIB_CLASSIC)
      Serial.println(F("JeeLib Classic"));
    #elif defined(RFM69_JEELIB_NATIVE)
      Serial.println(F("JeeLib Native"));
    #endif
    
  } else {
    Serial.println(F("RF = off"));
  }

}

CC @TrystanLea as the author of them as per History for emon_DB_12CT - openenergymonitor/avrdb_firmware · GitHub

From a defensive programming point of view, both should probably use the if/elif type pattern, and ideally have a catch-all else that probably outputs something… I’m guessing the firmware cannot be for more than one hardware simultaneously? And as such, the output of something like emonTx4emonPi2emonTx5 is unexpected, and similarly, unhandled?

And ideally, somewhere earlier on (rather than just on these serial outputs), a check for at least one of the relevant flags being set (during build/compliation), if that doesn’t exist already… To hopefully prevent this sort of thing in future.

Thanks!

At the moment my emonTx4 doesn’t have the 6CT extension fitted and is running emonTx4_CM_6CT_temperature_LPL so I can’t compare. And I haven’t tried autoconf

If

#define EMONTX4

has not been set, I have noticed in the code

// Pin definitions
#ifdef EMONTX4
const byte LEDpin = PIN_PB2;      // emonTx V4 LED
const byte DIP_switch1 = PIN_PA4; // RF node ID (default no change in node ID, switch on for nodeID + 1) switch off D8 is HIGH from internal pullup
const byte DIP_switch2 = PIN_PA5; // Voltage selection 240 / 120 V AC (default switch off 240V)  - switch off D9 is HIGH from internal pullup
#else
const byte LEDpin = PIN_PC2; // emonPi2/Tx5 LED
#endif

so this explains why your emonTx4 LED may not work!

Perhaps @TrystanLea could have a look at this?

Could the #define be passed in via platfromio - and thus its omission be part of the “encouragement” to use that? If so, a usable, clear and obvious fallback must be provided for those of us who don’t use it.

Hello @reedy

hardware = voltage = 1phase

I had this exact incorrect print out earlier when preparing a firmware. I had incorretly set the hardware #define at the top, I mistyped the EMONPI2 as EMONTX2…

// 1. Set hardware variant
// Options: EMONTX4, EMONTX5, EMONPI2
#define EMONTX5

Did we both do the same?

I didn’t build the firmware myself, I’m using the one offered by the firmware updater on emonpi, with the tx plugged into it

Which is supposedly built for the Tx4 based on the name of the file, but doesn’t seem to be based on what is seen in practice

Downloading firmware from:
https://raw.githubusercontent.com/openenergymonitor/avrdb_firmware/master/compiled/emonTx4/emonTx4_DB_12CT_1phase_LPL_v1_2_0.ino.hex

Downloaded file:
-rw-r--r-- 1 pi pi 66K Jun 16 17:49 /opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex

Which should mean the file is specifically avrdb_firmware/compiled/emonTx4/emonTx4_DB_12CT_1phase_LPL_v1_2_0.ino.hex at 01d2182a19406fd08c55970cc9019c29923d5ed2 · openenergymonitor/avrdb_firmware · GitHub

Thanks @reedy

So it was my error again (as above) :sweat_smile:

I’ve uploaded fixed hex files and tested here, could you try uploading again?

Thanks!

I’ll have another look later tonight when I’m back home and I’ve finished off doing some jobs.

It would be good practice to actually change/increase the version number (or add/increment a suffix) when anything changes (even if just rebuilding the same code, for example under different config or flags. But especially if you’re not embedding a git hash or similar in), as it’s entirely possible that users could be using multiple different versions (in this case, now 4?) that appear to be externally the same version. And it might not be possible to easily differentiate between them…

1 Like

Yay!

LAST ENTRIES ON THE LOG FILE
-------------------------------------------------------------
Firmware selected: emonTx4_DB_12CT_1phase_LPL
-------------------------------------------------------------
Downloading firmware from:
https://raw.githubusercontent.com/openenergymonitor/avrdb_firmware/master/compiled/emonTx4/emonTx4_DB_12CT_1phase_LPL_v1_2_0.ino.hex

Downloaded file:
-rw-r--r-- 1 pi pi 67K Jun 19 19:15 /opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex

EmonHub is running, stopping EmonHub

Uploading emonTx4_DB_12CT_1phase_LPL on serial port ttyUSB0
Attempt 1...

avrdude -Cavrdude.conf -v -pavr128db48 -carduino -D -P/dev/ttyUSB0 -b115200 -Uflash:w:/opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex:i

avrdude-original: Version 7.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

System wide configuration file is /opt/openenergymonitor/EmonScripts/update/avrdude.conf
avrdude-original yywarning() warning: ATmega329's flash writepage misses a necessary address bit a13 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:5932]
avrdude-original yywarning() warning: ATmega649's flash writepage misses a necessary address bit a14 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:6158]
avrdude-original yywarning() warning: AT90PWM2's eeprom writepage misses a necessary address bit a8 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:9348]
avrdude-original yywarning() warning: ATtiny44's eeprom writepage misses a necessary address bit a7 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11206]
avrdude-original yywarning() warning: ATtiny84's eeprom writepage misses a necessary address bit a8 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11390]
avrdude-original yywarning() warning: a4 would normally be expected to be a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a3 would normally be expected to be a4 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a2 would normally be expected to be a3 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a1 would normally be expected to be a2 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: a0 would normally be expected to be a1 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: too few opcode bits in instruction [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11675]
avrdude-original yywarning() warning: ATtiny43u's eeprom read misses a necessary address bit a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11694]
avrdude-original yywarning() warning: ATmega32U4's eeprom writepage misses a necessary address bit a2 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:11880]
avrdude-original yywarning() warning: AT90USB1286's eeprom writepage misses a necessary address bit a11 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:12275]
avrdude-original yywarning() warning: ATtiny1634's flash writepage misses a necessary address bit a5 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:15031]
avrdude-original yywarning() warning: mcuid -1 for ATtiny402w is out of range [0..2039], use a free number >= 372 [/opt/openenergymonitor/EmonScripts/update/avrdude.conf:15497]
User configuration file is /root/.avrduderc
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyUSB0
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : AVR128DB48
RESET disposition : dedicated
RETRY pulse : SCK
Serial program mode : yes
Parallel program mode : yes
Memory Detail :

Block Poll Page Polled
Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 1 0 0 0 0x00 0x00
prodsig 0 0 0 0 no 125 125 0 0 0 0x00 0x00
fuses 0 0 0 0 no 9 16 0 0 0 0x00 0x00
fuse0 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse1 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse2 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse4 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse5 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse6 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse7 0 0 0 0 no 1 1 0 0 0 0x00 0x00
fuse8 0 0 0 0 no 1 1 0 0 0 0x00 0x00
lock 0 0 0 0 no 4 1 0 0 0 0x00 0x00
data 0 0 0 0 no 0 1 0 0 0 0x00 0x00
flash 0 0 0 0 no 131072 512 0 0 0 0x00 0x00
eeprom 0 0 0 0 no 512 32 0 0 0 0x00 0x00

Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 25.1

avrdude-original: AVR device initialized and ready to accept instructions
avrdude-original: device signature = 0x1e970c (probably avr128db48)
avrdude-original: reading input file /opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex for flash
with 24076 bytes in 1 section within [0x200, 0x600b]
using 48 pages and 500 pad bytes
avrdude-original: writing 24076 bytes flash ...

Writing | ################################################## | 100% 3.72s

avrdude-original: 24076 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/data/firmware/emonTx4_DB_12CT_1phase_LPL.hex

Reading | ################################################## | 100% 2.46s

avrdude-original: 24076 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

Can we also work out making the process more robust in future too please?

Obviously accidents happen, but there’s things that can be done to improve the process (scripting, or compile time checks etc), failure conditions etc

Yes please! It would be nice to be able to do all of this via platformio scripting. Last time I tried I couldn’t work out how to specify the external crystal. Im not sure if that option was available. I haven’t had a chance to revisit it yet.