projects
projects
AVR programming with MAC OS X
Thursday, 20 September 2007
Having built a few kits with Microcontrollers, I decided I should learn more about them. More importantly how to program them. I chose an Atmel AVR microcontroller, and the project was to flash an LED. But where to start?
Well, I’ll need:
•Programmer.
•Development board.
•Software program.
•Tools keychain.
The programmer is an STK500V2 compatible SMD version from Tuxgraphics. Its amazingly small, and has a USB interface.
The development board is also from Tuxgraphics, and don’t forget to order some ATmega8 microcontrollers to play with too!
Humble beginnings: how to make an LED flash. The “Hello World” of AVR Micro-controller programming. How difficult can it be? Well, as I found out, there are a lot of concepts needed, but a full set of tools exists.
OS X is a great platform to develop AVR applications.
Software...
So how hard can it be to flash an LED? Well, luckily Tuxgraphics have some pretty good articles, and one of them contains a circuit and with code to do just that.
Keychain...
You’ll need to be comfortable with the OS X Terminal command line, but a full suite of AVR programming and development software exists for the Mac.
I quickly found OSX-AVR, downloaded their latest package, and double clicked the installer. The only addition I needed to make was to manually edit “/usr/share/misc/man.conf” to include the new man file path “/usr/local/man” for the installed programs.
To start, I flashed my AVR circuit with the pre-compiled HEX code using AVRDUDE.
The command I used was:
avrdude -c stk500v2 -p m8 -P /dev/tty.usbserial-A3000HEf -U flash:w:/Users/mike/Desktop/ledtest.hex
Perfect! It worked! How easy was that?
“ls /dev/tty.*” to find the TTY device name of the programmer.
I’ll update this page soon!