I’ve got an emonTx connected to the onboard serial on a a RasPi.
This works for comms, but presumably to be able to program the ATMega328 on the emonTx from the Pi, I need a way of resetting the ATMega.
EmonPi - OpenEnergyMonitor Wiki shows the EmonPi uses GPIO4 for that. Does that go to the reset pin on the ATMega328?
How does avrdude know that’s on GPIO 4? - the examples don’t seem to include anything on the command line to supply that?
Is it easier to use a USB serial adapter and connect up the DTR pin?
Avrdude doesn’t have the ability to control the reset via a gpio pin itself. There is a utility called avrdude-rpi that triggers any preset gpio pin for reset purposes.
OEM have a version that is installed to all emonSD images so it works fairly automatically once installed. There are instructions on how to install in the repo too, I hope they are still up to date, they were written years ago.
Not necessarily, if you only need to do it once then yes, but if you want the ability to upload new FW without fetching the USB programmer, then once you install this utility it is no different to USB, just a different address. The gpio pin is hardcoded in the utility to gpio4 (pin7) for the rfm2pi and emonpi, but you can use any pin. Obviously you will need both the TX and RX lines for upload if you don’t already have them connected for normal running.
So do you connect GPIO4 directly to the reset pin on the ATMega - which I assume will be one side of the reset button?
It’s more conveniently DTR on the FTDI connector - actually labelled “RST” on the silk screen. (Thus not to be confused with RTS )
Ahh great, I did wonder if that was the case!