AVR Assembly resources

ATmega328P

Simon Burkhardt

Guides

Downloads

Note: The general idea behind the assembly language is comparable to programming a microcontroller in C. With both languages, you have to look up the necessary registers in the datasheet of the microcontroller and set the corresponding bits. Just like writing a good old config.

Atmega321P Setup

Simon Burkhardt

Breadboard Setup

Connection to Programmer

If you installed avrdude according to the above tutorial and use the mentioned FTDI adaptor (Sparkfun), then connect the microcontroller as follows, using the SPI pins.

DTR -> RESET (1)
RXI -> MISO  (18)
TXO -> MOSI  (17)
5V  -> VCC   (7 & 20)
CTS -> SCK   (19)
GND -> GND   (8 & 22)

Attention!

Double check your connections, especially VCC and GND.

Avrdude Troubleshouting (Linux)

To upload a hex file, use the following command:

sudo avrdude -c ftdi -P ft0 -p m328P -U flash:w:file.hex

If it doesen't work, try the following steps:

  • correct wiring?
  • sudo
  • Reset pin connected with a pull-up?
  • ignore errors using -F
  • change the bitrate -b 115200
  • check if your USB adapter board is recognized -> ls /dev