emonTx backup and firmware

I’m trying to back up the firmware on my emonTx as per the docs at EmonTx V3.4 - OpenEnergyMonitor Wiki

Link to setting up Arduino IDE is dead but I have all that done. Command I am using, with OEM TTL adaptor, is:

avrdude -v -p atmega328p -c avrispmkII -P /dev/ttyUSB0 -U flash:r:test_intel.hex:i

Result is:

hpt@hpt:~/emonTx$ avrdude -v -p atmega328p -c avrispmkII -P /dev/ttyUSB0 -U flash:r:test_intel.hex:i

avrdude: Version 6.2
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/hpt/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : avrispmkII
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
         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 : STK500V2
         Description     : Atmel AVR ISP mkII
         Programmer Model: Unknown
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout

Also tried with sudo but no joy. Anyone successfully backed up their firmware?

emonTx boots up with the following details and is running a serial only firmware:

“emonTx V3.4 Discrete Sampling V2.90”

I have scoured GitHub for a version 2.90 of the firmware but nothing is coming up. Anyone know where the sketch or hex is?

George the bootloader cannot be read or changed via the serial port or the OEM programmer. The bootloader is installed via the 2x3 icp header inside the casing and it’s the bootloader that enables the ability to use the serial port on the 6x1 pin header to be used for uploading sketches.

The programmer (-c avrispmkII) in your command string is an “in circuit programmer” unlike the USB serial adapter and it also tries to upload a new hex (-U flash:r:test_intel.hex:i" so failure in this instance is your friend, if this had worked it would have over written your firmware and it would be lost for ever.

v2.9.0 appears to be the current version

although you can get the v2.9.0 version specifically by selecting the tag in the branch drop down list

1 Like

Correct. Sadly, those instructions have been deleted. I can supply a copy, and the instructions for installing the libraries, if you say which OS you are using (Linux, Mac or Windoze).

I can’t find a V2.9 Serial only version either - are you sure it is serial-only and that you’re not simply ignoring the radio output? Since V2.4, it has supported CSV string pairs to work with emonESP, e.g. the format is “ct1:100,ct2:329, …”
That is on Github in …/emontx3/firmware/src

1 Like

It’s not the bootloader I am wanting to backup, it’s just that the firmware backup procedure in the docs is in the bootloader section.

So the docs are wrong?

Not sure why the GitHub search was failing, although I think the references are just v2.9 not V2.90 or v2.9.0.

My Arduino IDE (Windows and Ubuntu) are fine I was just pointing out the dead link.

The emonTx was sent to me as Serial only but I think you are right as I get the +++ to configure RF prompt etc, even though I don’t use RF.

My bad, I didn’t look close enough and see the “r” in your command (flash:r:), yes that is to read. but command string is still incorrect for your programmer hence the error messages/failure.

Try something like

avrdude -v -p atmega328p -c arduino -P /dev/ttyUSB0 -U flash:r:emontx_fw_backup.hex:i

(untested)

1 Like

Switched to Windows and copied avrdude.conf to the directory with avrdude.exe (rather than messing about with path).

avrdude -v -p atmega328p -c arduino -P COM12 -U flash:r:emontx_fw_backup.hex:i

4.2s, job done.

@glyn.hudson not sure if I was misunderstanding the “backup” section. Perhaps it was backup bootloader via ICP header, rather than firmware via TTL. Maybe check your docs and make it a little clearer.

Edit: I only switched to Windows because I’m in a different office now and I have no reason to think it wouldn’t work with Ubuntu and using the correct programmer in the command line (and Ubuntu com port format).

I did notice that, but I mentioned the availability of the old instructions for the benefit of anyone reading this thread later, who doesn’t have the Arduino IDE installed.

1 Like

The old Arduino IDE instructions were very outdated, best to follow the excellent multi platform latest install guide from the Arduino website:

@glyn.hudson maybe someone at OEM can change the link in the docs.

Done :+1:

1 Like