Arduino ISP bootloader problems and solutions

Arduino ISP bootloader problems and solutions

Just started learning to use atmel chips and using my arduino mega as an ISP programmer and thought I would post a quick list of the main problems I had and how I fixed them in case anyone else is getting stuck like I was.

Now I know all the problems a quick check list should be something like this:

  • Check wiring connections / basic power etc

 

  • MAKE sure Auto reset actually connected I.e pin 2 on FTDI chip (DTR line)
    • this one got me, I thought it was on so I never hit reset manually and just assumed boot loader was getting over written when it wasn't. The boot loader just assumed as I never tried to download a new sketch within 1 sec of hitting reset that it would just run existing download code as it is meant too.
  • Make sure you have the latest arduinoISP / IDE as old versions cause a lot of problems
    • how to get and build latest arduino tools ide + avrdude
    •  http://code.google.com/p/arduino/wiki/BuildingArduino
       
  • Check what baud rate programmer is meant to be running at if you get this wrong you will get the "programmer not responding" error
  • If your new boot loader is not working make sure you disconnected your arduino mega ISP programmer. If left connected can stop things working or at least did for me
  • If boot loader downloads but does not accept or respond to new sketch check auto reset or at least make your you download within 1 sec of hitting reset. See details about your version of boot loader for how long it waits

Useful links

Using an Arduino as an AVR ISP (In-System Programmer)
http://arduino.cc/en/Tutorial/ArduinoISP

Examples of setting up isp circuits
http://www.kanda.com/avr-isp-circuits.html

Engbedded Atmel AVR® Fuse Calculator
http://www.engbedded.com/fusecalc/

Arduino ISP using mega1280 not working

Version of arduinoISP I used had comments saying pin 10-13 used for ISP functions when really its 50-53 on a mega so watch out for this. Think newer versions have defines at top of code and don’t use the defines include in the chip type header files.

53    Reset
51    MOSI
50    MISO
52    SCK

"avrdude: stk500_cmd(): programmer is out of sync" programmer error

solution: download and use this updated ArduinoISP file
http://mega-isp.googlecode.com/files/ArduinoISP.04.zip
Source: http://amanica.blogspot.com/
NOTE: think this is already old since i now use the version from latest github
see: http://code.google.com/p/arduino/wiki/BuildingArduino
direct link to just ISP sketch: https://github.com/arduino/Arduino/tree/3dfc2c631110d912656d3bd02c7a07d1...

* sometimes can just run avrdude command again and things will work


"avrdude: verification error, first mismatch at byte" error

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x00ea
         0x84 != 0x80
avrdude: verification error; content mismatch
avrdude: Send: Q [51]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

Was happening to me after I downloaded blink example successfully once. But When I changed port pin and re-downloaded file I got this error. But the following chip erase command fixed it and allowed arduino IDE to upload new blink script

./avrdude -C ./avrdude.conf  -patmega168 -cstk500v1 -P/dev/ttyUSB0 -b19200 -v -e


get arduino IDE to display more debug info

Open preferences.txt file normally under /home/CURRENT_USER/.arduino and add the following

upload.verbose=true
build.verbose=true
-------------------------------------------


a few avrdude examples

see man avrdude for option help

Dump flash from micro

chiptoxic@maia:~/software/arduino-1.0-64bit/hardware/tools$ ./avrdude -C ./avrdude.conf  -pm168 -cstk500v1 -P/dev/ttyUSB0 -b9600 -U flash:r:/home/chiptoxic/dump.hex:i -v

writing fuse bits

write default fuse bits (for this micro)
chiptoxic@maia:~/software/arduino-1.0-64bit/hardware/tools$ ./avrdude -C ./avrdude.conf  -pm168 -cstk500v1 -P/dev/ttyUSB0 -b19200 -v -e -U lock:w:0x3f:m -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0x01:m

reading fuses

chiptoxic@maia:~/software/arduino-1.0-64bit/hardware/tools$ ./avrdude -C ./avrdude.conf  -pm168 -cstk500v1 -P/dev/ttyUSB0 -b9600 -U lock:r:-:h -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h -v