Uploading firmware to the ATMEGA 328P

I am in the middle of assembling a heatpump board. I now need to upload the firmware to the ATMEGA chip.

How? Should I use ESPTOOL? Should I use the Arduino application?The documentation (HeatpumpMonitor/firmware-upload.md at master · openenergymonitor/HeatpumpMonitor · GitHub) is rather light on how to do this…

I do have a working USB/UART that I upload tasmota to sonoff devices.

I have tried using ESPTOOL and teh Arduino, buit cannot figure out how I should be doing this.

Uploading to the ATmega 328P is covered in the ‘Learn’ section under two headings. Setting up the Arduino IDE is here:

Learn→Electricity Monitoring→Using the Arduino IDE

and using the programmer is here:

Learn→Electricity Monitoring→Programmers

The GND end of the FTDI connector is marked on the pcb (it’s the left-hand end when the main printing is the right way up.

By some miracle, the Rx and Tx pins in the heatpump board are labelled conventionally, so it is the normal Tx → Rx and Rx ← Tx, and the ‘Shop’ programmer can plug in directly onto the header.

I don’t have a heatpump board, so all I can tell you is what appears on the layout and circuit diagrams.

Thank you.

I now understand that I am going to need to compile and upload the code, including the libraries. Now I realise I was anticipating the the upload would be pre-compiled binaries.

The heat pump board has a specific tx/rx for the atmega. I think that there is a second upload location with the row of pins for the esp8266. Am I correct in thinking that I should be using the dedicated tx/rx for the atmega?

The spec for the FTPI programmer has a CTS/RTS. Do these have to be used? Or can these be ignored?

I have an existing low cost Usb UART programmer which has a tx/rx which works okay with all my other other ESP8266s. Can I use this programmer, or do I need to get a new one from the OEM shop?

George

Correct - that is quite clear from the circuit diagram HeatpumpMonitor/HeatpumpMonitorTH/Hardware/v4 at master · openenergymonitor/HeatpumpMonitor · GitHub
On the picture HeatpumpMonitor/HeatpumpMonitorTH/energymonitor_build.md at master · openenergymonitor/HeatpumpMonitor · GitHub, this is the 6-pin header nearest to the Welsh Dragon.

Also correct, also shown clearly on the circuit diagram, and the picture (it’s right next to the ESP8266). GND is the left-hand end of that one too.

RST cannot. it is used to reset the Atmel '328P to put it into programming mode. That must be connected. The circuit diagram and pcb layout both show no connection to the CTS pin. CTS can be ignored.

Maybe. It depends on whether it drives the RTS pin properly, as commanded by the software. If it does not, it is said to be possible to generate a reset pulse manually by earthing the pin at the appropriate instant, but the timing is critical.

Brill. I was using the rx/tx on the jumper pins!!! I did not realise that there was a six pin upload connection for the Atmega. It all makes a bit more sense.

I will now go and purchase the correct upload tool, which will hopefully to use be easily with what I now know.

I might even be able to pluck up the courage to update my TX3, which is still running v2.3.0.

G

I have managed to get the ATMEGA to upload. I did end up using an old Arduino Uno board and moving the chip, which seemed to work.

Now I cannot get the ESP12 to upload! I have checked teh soldering and I think the board is correct, though might well have missed something.

I am using the supplied FTDI board. I can get both leds on the programmer, plus the blue LED on the board to flash. But… my python esptool.py --port COM8 erase_flash command does nothing.

I know my esptool and python work fine as I regularly us the same computer to upload tasmota to sonoff devices, though I do use a different programmer.

Help!

Where could I turn next to figure out what is wrong!