Atmel AVR USBASP Programming
I thought to try another microcontroller family, Atmel. Got a USBASP Programmer and messed my first Atmel microcontroller by setting wrong fuses. And after some googling I found that I can’t fix it without HVPP(high voltage parallel programming).
Atmel microcontrollers support 3 programming modes.
- ISP (In System Programming)
- High Voltage Programming
- JTAG programming
USBASP uses ISP method. ISP requires the reset pin. In atmel microcontrollers the reset pin can be configured to be used as a I/O pin by setting a fuse. But if you do that you will need high voltage programming circuit to reprogram the microcontroller.
Also for ISP, once the fuses are set corresponding for a clock source, you are required to provide the same clock source for future programming. Otherwise you will need to use high voltage programming. So be careful when setting the fuses.
Connect the USBASP signals (Reset, SCK, MISO, MOSI, VCC, GND) referring to the pin out in the datasheet. AREF and AVCC pins of the microcontroller should be connected to VCC even if you are not using ADC.
I tried several softwares to use with USBASP. Progisp 1.72 seems to be ok.
For Atmega328p using 20MHz crystal set the fuses as follows
CKDIV8 1 //not using internal oscillator anymore CKOUT 1 //disable clock out on PB0 SUT1 1 //selecting start-up time SUT0 1 //selecting start-up time CKSEL3 0 //selecting clock source CKSEL2 1 //selecting clock source CKSEL1 1 //selecting clock source CKSEL0 1 //selecting start-up time
For fuses “1” means unprogrammed while “0” means programmed.
Ref – http://www.atmel.com/Images/doc8271.pdf
Comment if you have problems.