Hi,
I've been trying to build up arduino on a breadboard by following this tutorial http://www.arduino.cc/en/Main/Standalone .. i also burnt the bootloader onto an atmega8 using this tutrial Arduino Playground - Burn168 .. in the arduino(version 21) folder under hardware/arduino/bootloaders/ .. i went into the atmega8 folder and burnt the hex file present in that folder .. and after putting it in the breadboard with a 16mhz crystal( with the right fuse settings ).. the LED on 13th pin blinked every 10 seconds ( hoping thats right) .. then i connected a rs232 board ( with max232 IC ) to the breadboard and got a serial connection..
In the arduino software , under Board when i choose boards like duemilanove or arduino pro or arduino BT , it used to give me an error saying wrong microcontroller detected.change by choosing the right one under tools->board ..Then i selected the last option Arduino NG ( older w/ ATmega8 ).. This time it looked like it uploaded.. ( i uploaded a program to blink the led in 13th pin every second).. But i got the following error
Binary sketch size: 834 bytes (of a 7168 byte maximum)
avrdude: verification error, first mismatch at byte 0x0000
0x3f != 0xff
avrdude: verification error; content mismatch
And the LED still blinks only every 10 seconds..SO i guess it didnt quite upload correctly..Does anybody know what the verifcation error means?
When I got an error like that it was because avrdude was trying to set the Lock byte and the bootloader doesn't support the lock write and read part of the STK500 protocol. In the Arduino preferences file you can add the line "upload.verbose=true" to get more information about the upload process.
hey,
Thanks for your reply. I did what you told me and tried uploading again.Here is the output http://dl.dropbox.com/u/904687/arduinooutput.txt .. Im using an external 16mhz clock.. and the default blink LED blinks every 10 seconds on pin 13..Is that how its supposed to be?
For some reason it appears that the received bytes are not being logged. From the fact that it gets the device signature successfully we can deduce that it is properly receiving data from the chip.
Everything looks good up to the end of the verification step where it says the byte at 0x0000 read as 0xff when it was written as 0x3f. Could the lock bits be set incorrectly? They should have been set (and verified) when you wrote the bootloader.
hey,
thanks for your reply..I think i might have made a mistake there.. Could you point me to a good tutorial so i can burn the right hex file for the atmega8 using avr studio software? can i use the atmega168 hex files on the atmega8? i think i might have burnt the wrong hex file and might have set the wrong lock bits. If there is any way you could guide me through this..for the atmega8..it would be really helpful..Thanks..
hey..thanks for your reply.. the arduino IDE does not recognize my programmer so i used AVR studio to burn the atmega8 hex file. to upload code i tried using arduino IDE but thats when i got the error mentioned in the first post..THe programmer im using is similar to this http://nskelectronics.com/avr_dude.html
thanks for your reply.. for some reason arduino isn't recognizing my ISP burner.. i dont think its mkII .. i already set the fuse settings to use an external crystal( ive inserted 16mhz ).. i dont think i can undo that.. I think i need to get the lock bits right..
Hmm ,
I had this exact same set of symptom(s) occur to me also while working with the 1284P(s) chip on my sanguino breakout(replaced my 644P). I have burned the adaboot 1284 bootloader using a spare 328P dieciellma loaded with megaISP and prevented from booting with the 120ohm resistor trick.
I then found that I could NOT load arduino programs compiled to .hex files either from the command line(above error) or from the arduino environment(strange error after replacing avrdude, setspeed issues in that environment) after burning this bootloader.
However when I used the Arduino in MegaISP mode to program the 1284P chip with the arduino test program EVERYTHING loaded and ran perfectly after bringing up the sanguino hardware.. (NOT a fuses issue)..this was from the command line(after bootloader programming).
wondering what gives as I see people constantly searching for the solution to this error but having to load arduino .hex files with a ISP programmer gets highly inconvenient(at least in my case)... and sucks as a solution(I need to update the arduino environment properly for the new avrdude and 1284P chip)
Meh, I use my arduino as a programmer, and that was something that I wanted to ask you on this. The way that programmer looks, does it already have an Atmel chip in the socket? If so then you may need to pull your reset high (with a 120 ohm resistor between reset and ground). I have had crazy troubles with my arduino as an ISP until I disabled reset. It's been smooth sailing all the way since then.
but just to ask have you tried using avrdude by itself? It's not that hard.
here is the minimum syntax:
avrdude.exe -p [chip to program] -P [port your programmer is on] -c [name of programmer] -b [baud rate of programmer, usually 19200]
Major parts: any of these parts you would do good to add -e which erases the chip before doing whatever you want it to do.
to lock, or unlock the bootloader add this to the end of the syntax:lock:w:[lock/unlock bits]:m
to set fuses add this to the end of the syntax:lfuse:w:[fusebits]:m -U hfuse:w:[fusebits]:m
to flash a hex file add this to the end of the syntax: flash:w:[your .hex file]
So for example to unlock the bootloader, burn the bootloader, lock the bootloaderset the fuse bits, and then flash an app to an atmega32 using an Arduino As ISP, you would type:
unlocks chip and uses internal 8mhz oscillator
avrdude -p m32 -c avrisp -b 19200 -P com4 -e -U lfuse:w:0xd4:m -U hfuse:w:0x99:m unlock bootloader
avrdude -p m32 -c avrisp -b 19200 -P com4 -U lock:w:0x3F:m flash arduino bootloader
avrdude -p m32 -c avrisp -b 19200 -P com4 -e -U flash:w:AtmegaBOOT_168_diecimila.hex lock the bootloader in
avrdude -p m32 -c avrisp -b 19200 -P com4 -U lock:w:0x0f:m upload a hex file(or arduino sketch if you may call it. still a hex file)
avrdude -p m32 -c avrisp -b 19200 -P com4 -U flash:w:atmega32blinkpin32.cpp.hex
Also
I have recently found you can upload arduino code through your isp programmer straight to the chip! So you don't have to even have an ftdi if you don't want (and you don't have to use avrdude directly to do it either!)
For your atmega 8, change the boards.txt entry to this:
atmega8.name=Atmega8 programming through ISP
atmega8.upload.using=avrisp*or the name of your programmer!
atmega8.upload.maximum_size=7168
atmega8.upload.speed=19200
atmega8.bootloader.low_fuses=0xdf
atmega8.bootloader.high_fuses=0xca
atmega8.bootloader.path=atmega8
atmega8.bootloader.file=ATmegaBOOT.hex
atmega8.bootloader.unlock_bits=0x3F
atmega8.bootloader.lock_bits=0x0F
atmega8.build.mcu=atmega8
atmega8.build.f_cpu=16000000L
atmega8.build.core=arduino
This method worked for me on a atmega328-PU very well after being unable to get my breadboard 8Mhz Arduino bootloader working properly!
I also used
atmega328bb.upload.speed=19200 (for some reason the breadboard.zip sample has the 8Mhz chip set 56kbps, which didn't work for me).
and
signature = 0x1e 0x95 0x14; (instead of 0x1e 0x95 0x0F, in avrdude.conf)
I know this is way old, but I came across this problem recently. I was using a nano, connected to my computer via the USB, but also connected to an ESP8266 on the TX and RX pins. I wasn't using it yet, so it was no big deal to disconnect it, but for some mysterious reason, I kept getting this error until I removed the connection to the ESP. Hope this helps someone!