So I tried a new thing today, updating the firmware on the RFMpi. Since I'm about to replace the RFM12b with a RFM69cw I figured it would be wise to try and upload the RFM12b firmware first before I'd start replacing the hardware.
I followed the (very easy) guide - http://wiki.openenergymonitor.org/index.php?title=RFM69Pi_V3 - and used the firmware for the RFM12b
avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:RFM12_Demo_ATmega328.cpp.hex
Unfortunately this led to quick stop. After the "using autoreset..." message it simply stopped.
avrdude-original: Version 6.1, compiled on Jul 7 2015 at 13:18:47
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 "/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
pi@raspberrypi ~/RFM2Pi/firmware/RF12_Demo_atmega328 $Fortunately I'm not the only one (link) and found out that avrdude version 6.1 was the culprit and this could be solved by using an older version (5.11). So an easy solution to my misery was to remove 6.11
sudo apt-get remove avrdude sudo rm /usr/bin/avrdude-original
and update the installation script of avrdude-rpi to force apt-get to use version 5.11:
#!/bin/bash echo "display serial console to enable use of /dev/AMA0 serial port" sudo wget https://raw.githubusercontent.com/openenergymonitor/rpi-serial-console/m... -O /usr/bin/rpi-serial-console && sudo chmod +x /usr$ sudo rpi-serial-console disable sudo apt-get install -y avrdude=5.11.1-1 python-dev python-rpi.gpio minicom echo "install avrdude autoreset" sudo cp /home/pi/avrdude-rpi/autoreset /usr/bin sudo cp /home/pi/avrdude-rpi/avrdude-autoreset /usr/bin if [ ! -f /usr/bin/avrdude-original ]; then sudo mv /usr/bin/avrdude /usr/bin/avrdude-original sudo ln -s /usr/bin/avrdude-autoreset /usr/bin/avrdude fi
Now when I issue the same command, everything works :-)
pi@raspberrypi ~/RFM2Pi/firmware/RFM69CW_RF_Demo_ATmega328 $ avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:RFM12_Demo_ATmega328.cpp.hex
avrdude-original: Version 5.11.1, compiled on May 23 2012 at 11:08:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/etc/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
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
avrdude-original: safemode: lfuse reads as 0
avrdude-original: safemode: hfuse reads as 0
avrdude-original: safemode: efuse reads as 0
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 "RFM12_Demo_ATmega328.cpp.hex"
avrdude-original: input file RFM12_Demo_ATmega328.cpp.hex auto detected as Intel Hex
avrdude-original: writing flash (8982 bytes):
Writing | ################################################## | 100% 3.17s
avrdude-original: 8982 bytes of flash written
avrdude-original: verifying flash memory against RFM12_Demo_ATmega328.cpp.hex:
avrdude-original: load data flash data from input file RFM12_Demo_ATmega328.cpp.hex:
avrdude-original: input file RFM12_Demo_ATmega328.cpp.hex auto detected as Intel Hex
avrdude-original: input file RFM12_Demo_ATmega328.cpp.hex contains 8982 bytes
avrdude-original: reading on-chip flash data:
Reading | ################################################## | 100% 2.87s
avrdude-original: verifying ...
avrdude-original: 8982 bytes of flash verified
avrdude-original: safemode: lfuse reads as 0
avrdude-original: safemode: hfuse reads as 0
avrdude-original: safemode: efuse reads as 0
avrdude-original: safemode: Fuses OK
Hope this helps for others with the same challenge
Re: Solved: avrdude-original: Using autoreset DTR on GPIO Pin 7
Nice work, thanks a lot for figuring this out. It's strange that the new version of avrdude caused issues. Avrdude V6.1 works fine uploading to the emonPi and autorest via GPIO
avrdude version 6.1
I'm using baud 115200, this is the only difference I can see.
https://github.com/openenergymonitor/emonpi/blob/master/emonpiupdate
=================================
EmonPi update started
=================================
Start ATmega328 serial upload using avrdude with emonPi_latest.hex
avrdude-original: Using autoreset DTR on GPIO Pin 7
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
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 "/home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_latest.hex"
avrdude-original: input file /home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_latest.hex auto detected as Intel Hex
avrdude-original: writing flash (19074 bytes):
Writing | ################################################## | 100% 2.73s
avrdude-original: 19074 bytes of flash written
avrdude-original: verifying flash memory against /home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_latest.hex:
avrdude-original: load data flash data from input file /home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_latest.hex:
avrdude-original: input file /home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_latest.hex auto detected as Intel Hex
avrdude-original: input file /home/pi/emonpi/Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_latest.hex contains 19074 bytes
avrdude-original: reading on-chip flash data:
Reading | ################################################## | 100% 2.06s
avrdude-original: verifying ...
avrdude-original: 19074 bytes of flash verified
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
avrdude-original done. Thank you.
strace: |autoreset: Broken pipe
Re: Solved: avrdude-original: Using autoreset DTR on GPIO Pin 7
avrdude 6.1 breaking changes #4
I can confirm this as I have been using 0.3s for some months now, at that time I found anywhere between 0.24s to 0.34s seconds worked but had hoped to find out what the actual required timing by spec was, to be sure it was right but I haven't as yet.
Paul
Re: Solved: avrdude-original: Using autoreset DTR on GPIO Pin 7
Thanks, I've updated our version and tested 0.32 sleep. Works fine https://github.com/openenergymonitor/avrdude-rpi
Do you mean 0.32 or 0.34?
the github issue says 0.32. They both probably work!
Re: Solved: avrdude-original: Using autoreset DTR on GPIO Pin 7
I'm sure 0.32 will be fine!
In my tests anything from 0.24 to 0.34 seemed to work, I use 0.3 since 0.29 is centre of the working range (and 2 decimal places seemed overkill at this level of science).
This has worked for me for many months as I was using 6.1 way before ir reached wheezy stable due to it's spi/gpio programming ability not in 5.11.
Paul