Programming a micro-controller is the process of downloading the code you have written on a computer, onto the on-board memory of the micro-controller so it can then run and execute it.
Programming of most Atmel chips can be done with either one of the range of Atmel or 3rd party/self built programmers (this is a piece of hardware). To download the code you need some software that support the hardware device that you are going to use. Atmel supplies some inbuilt with AVR Studio, or you can download external, free ones such as the popular GUI based PonyProg (supports most nix and Windows operating systems, but as of early 2011 some manipulation was required to get it running on 64x windows) or the command line interface AVRDUDE.
ISP (in-circuit-programming) is one of the easiest ways of programming micro-controllers. To program any AVR chip, all you need is a computer, a ISP programmer (such as the AVRISP MkII), and the self-powered target chip. If you are using the AVRISP MkII, all you need to do is connect the following pins to the 6-pin header in the following order:
An ATmega8 has the following pins:
- MISO: Pin 18 (PB4)
- VTG: Pin 7
- SCK: Pin 19 (PB5)
- MOSI: Pin 17 (PB3)
- RST: Pin 1
- GND: Pin 8, Pin 22
If you connect the MkII up and it flashes orange (it’s got some fancy smarts inside of it which makes sure every thing is connected up properly before you can even try to program with it), chances are you have got one or more of the connections the wrong way around.
The Reset Line
The reset line is dual purpose, in normal operation it can be used to perform a “traditional” reset of the microcontroller’s firmware. It is also used when programming.
The reset line is active-low logic. It is usually controlled/driven by the programmer (e.g. the AVR MkII ISP programmer). While the reset line is active, all GPIO on the microcontroller are turned in inputs with pull-ups disabled.
The reset line is held active (low) for almost all of the programming sequence. The one exception is at the end of an erase cycle (which is usually part of the programming sequence).
Posted: September 15th, 2011 at 9:54 am
Last Updated on: October 29th, 2015 at 12:08 pm