Programming Atmega 328 using UART


3 posts
by nielsheirman » Mon Apr 15, 2013 4:16 pm
Hi,

I was wondering wheter it is possible to program the Atmega chip over the Pi's uart.
The way i understand it, the atmega chip supports programming trough its serial port.
However, this is mostly done by using some usb to serial cable.

The question arises because i need to use the atmega's SPI port, and i'm not willing to sacrifice a usb port either.

Thanks in advance,

Niels
Posts: 1
Joined: Mon Apr 15, 2013 3:56 pm
by silverfox0786 » Mon Apr 15, 2013 9:25 pm
you can send code (i.e) sketches over UART

the way I do it is via alamode

5v, GND, RX, TX and pin 18 for reset

and a patched avrdude


if you mean program a chip for example a bootloader for arduino then its known to be possible with the GPIO but I have not found a way yet


btw seeing as your on the gertboard section I am assuming you want to use the gertbaord atmega and if so then the gertboard manual has all the info on how to use and send sketches over


Gordon Henderson has the info on his website
User avatar
Posts: 215
Joined: Mon Feb 04, 2013 10:32 pm
Location: Slough, UK
by gordon@drogon.net » Mon Apr 15, 2013 9:32 pm
nielsheirman wrote:Hi,

I was wondering wheter it is possible to program the Atmega chip over the Pi's uart.
The way i understand it, the atmega chip supports programming trough its serial port.
However, this is mostly done by using some usb to serial cable.

The question arises because i need to use the atmega's SPI port, and i'm not willing to sacrifice a usb port either.

Thanks in advance,

Niels


Yes you can - however - you first need to get the bootloader into the ATmega on the Gertboard - but that can be a one-off operation. The next issue is that the bootloader needs to know that the ATmega is running at 12MHz, else the baud rate will be wrong. Finally, there is the issue of auto-resetting the ATmega prior to loading new code into it - this can be solved by using a single GPIO line from the Pi.

I've had some personal (family) issues the past few weeks which is getting in the way, but it's on my to-do list along with a lot of other new stuff for the Gertboard too - hang in there, or use the above as a starting point ;-)

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1540
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK