Interface raspberryPi with Atmega328P?

Hi everyone.

I developed a PCB for single phase emonPi and I brought a emonSD for the raspberry Pi, So when connect the Raspberry Pi to single phase emonPi PCB ( base on ATMEGA 328P) then I cannot update or upload arduino codes to the PCB. So, my question is how would I interface the raspberryPi to Atmega328P?

Many thanks.

Assuming you have the correct physical connections and also the correct upload settings in the IDE, have you burnt a bootloader to the ATmega328p?

New MCU do not tend to have a bootloader installed and it is needed to allow the subsequent uploads of sketches over serial. It only needs doing once and then you can install sketches via the serial port.

however you cannot install a bootloader over serial. you will need a parallel programmer, or alternatively you can use the Pi’s SPI conn’s on the GPIO with a few jumper wires if you have an ICP header on the emonpi board.

1 Like

Thanks Paul for the reply.

Yeah, I did burn the bootloader to the atmega328p. I can upload the code to the atmega328p but when I connect it into the ResberryPi then I get a lot of errors. Please find the attached picture.
errors

Why do you have it connected to both your PC and the Pi?

That is possibly the cause of the errors.

How do you have it connected to the PC? via the 2x3pin ICP or 1x6pin “FTDI” header?