Difference between revisions of "Programming AVR micro-controllers"

From ShawnReevesWiki
Jump to navigationJump to search
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This document is intended to collect tips on programming AVR micro-controllers, such as Atmel's ATMEGA328P.
 
This document is intended to collect tips on programming AVR micro-controllers, such as Atmel's ATMEGA328P.
 
==Developing programs==
 
==Developing programs==
Lady Ada writes a tutorial for learning to program AVR micro-controllers, including setting up a CLI-based environment with gcc. <ref>http://www.ladyada.net/learn/avr/index.html</ref>
+
Lady Ada provides a tutorial for learning to program AVR micro-controllers, including setting up a CLI-based environment with gcc. <ref>http://www.ladyada.net/learn/avr/index.html</ref>
 +
 
 +
Instructables includes an instructable on programming ATtiny with the Arduino IDE. It involves adding core files to a 'hardware' folder inside the Arduino>Sketchbook folder.  <ref>http://www.instructables.com/id/Program-an-ATtiny-with-Arduino/</ref>
 +
 
 +
 
 +
==Burning fuses==
 +
Before uploading a program or concurrently, you might need to set 'fuses' on the micro-controller that control whether the chip uses its internal or external clock and other parameters. For example, the Atmel 328P micro-controller comes from the factory set to use its internal clock, so if you load a program expecting to use an external 16MHz crystal and then it seems to run slow, perhaps you didn't burn the fuses yet.
 +
 
 
==Uploading programs==
 
==Uploading programs==
There are many ways to upload programs onto chips.
+
There are many ways to upload programs onto chips. The key is getting the bytes of the compiled program onto the target chip, usually done by an intermediating micro-controller known as a programmer.
 +
===Parallel port ISP===
 +
One can connect in-circuit-serial-programming pins to a parallel port on the host computer, if available. <ref>http://www.arduino.cc/en/Hacking/ParallelProgrammer</ref>
 
===Arduino as ISP===
 
===Arduino as ISP===
The Arduino community provides a simple way to use an existing Arduino to program a new AVR chip, at least to burn an Arduino bootloader onto it. An AVR on a breadboard, optionally with a crystal oscillator, is connected by four wires to an Arduino, which takes the program from the computer and programs it onto the AVR.<ref>http://arduino.cc/en/Tutorial/ArduinoISP</ref>
+
The Arduino community provides a simple way to use an existing Arduino to program a new AVR chip, including burning an Arduino bootloader onto it. An AVR on a breadboard, optionally with a crystal oscillator, is connected by four wires to an Arduino, which takes the program from the computer and programs it onto the AVR.<ref>http://arduino.cc/en/Tutorial/ArduinoISP</ref>
 +
 
 +
Arduino forums user Lauszus wrote a lengthy tutorial on using ArduinoISP to program AVRs in general.<ref>http://forum.arduino.cc/index.php?topic=65099.0</ref>
 +
 
 +
===Dedicated AVR programmers===
 +
;Tiny AVR Programmer:Meant to program ATtiny45 and ATtiny85, 8-pin DIP controllers from Atmel, but can program any AVR micro-controller since it has female headers to accept wires to any AVR. One of the cheapest programming platforms.
 +
:In the Arduino IDE, choose USBTinyISP from the Tools>Programmer menu.
 +
:Also see Sparkfun's tutorial: https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide/
 +
:https://www.sparkfun.com/products/11801
 +
;Atmel branded ISP
 +
:http://www.atmel.com/tools/MATUREAVRISP.aspx
 +
 
 +
==See also==
 +
*[[Programming Arduino]]
 +
 
 +
==References==
 +
<references />
  
 
[[Category:Electronics]]
 
[[Category:Electronics]]

Latest revision as of 19:16, 14 May 2014

This document is intended to collect tips on programming AVR micro-controllers, such as Atmel's ATMEGA328P.

Developing programs

Lady Ada provides a tutorial for learning to program AVR micro-controllers, including setting up a CLI-based environment with gcc. [1]

Instructables includes an instructable on programming ATtiny with the Arduino IDE. It involves adding core files to a 'hardware' folder inside the Arduino>Sketchbook folder. [2]


Burning fuses

Before uploading a program or concurrently, you might need to set 'fuses' on the micro-controller that control whether the chip uses its internal or external clock and other parameters. For example, the Atmel 328P micro-controller comes from the factory set to use its internal clock, so if you load a program expecting to use an external 16MHz crystal and then it seems to run slow, perhaps you didn't burn the fuses yet.

Uploading programs

There are many ways to upload programs onto chips. The key is getting the bytes of the compiled program onto the target chip, usually done by an intermediating micro-controller known as a programmer.

Parallel port ISP

One can connect in-circuit-serial-programming pins to a parallel port on the host computer, if available. [3]

Arduino as ISP

The Arduino community provides a simple way to use an existing Arduino to program a new AVR chip, including burning an Arduino bootloader onto it. An AVR on a breadboard, optionally with a crystal oscillator, is connected by four wires to an Arduino, which takes the program from the computer and programs it onto the AVR.[4]

Arduino forums user Lauszus wrote a lengthy tutorial on using ArduinoISP to program AVRs in general.[5]

Dedicated AVR programmers

Tiny AVR Programmer
Meant to program ATtiny45 and ATtiny85, 8-pin DIP controllers from Atmel, but can program any AVR micro-controller since it has female headers to accept wires to any AVR. One of the cheapest programming platforms.
In the Arduino IDE, choose USBTinyISP from the Tools>Programmer menu.
Also see Sparkfun's tutorial: https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide/
https://www.sparkfun.com/products/11801
Atmel branded ISP
http://www.atmel.com/tools/MATUREAVRISP.aspx

See also

References