On my latest board based on the ATmega2560 I've been struggling with getting software running on it, the Arduino bootloader won't upload without giving a mismatch and sketches directly programmed through a USBasp interface won't run at all.
When burning the bootloader it gives this error:
avrdude: verification error, first mismatch at byte 0x1e000
0xff != 0x0d
I have read through a bunch of thread about this verification error but most of the talks about "Arduino as ISP" and this is purely about uploading the bootloader to the MCU with a USBasp interface. I have another board based on the ATmega644PA which works with the same basic circuitry (see attachment) and it runs fine, both accepts and runs the bootloader and sketches when they are directly uploaded via the USBasp.
Is there any big difference between these MCUs and how they work that I have missed out on?
And why won't it run the simple "Blink" sketches I've uploaded, neither the standard "Blink" nor the one I wrote that flashes all digital pins shows anything on the MCU pins. I can read and verify the code written to the flash memory through eXtreme Burner - AVR which proves it has been written in the flash correctly.
What can be wrong? I'm leaning towards circuit fault or fuses set in a wrong way; but the circuitry have been used on another board with no problems so I don't really have a clue. And that board also runs the MCU with the default fuses set.
What can stop the MCU from running? Any fuses that needs to be set thats not set by default?
A funny thing is that after the bootloader fails writing to memory (takes about 5min before the IDE gives the error) the TXD0 line goes high...which proves somethings been programmed in and runs...nothing I've been able to mimic with my own code...
Do you have any decoupling capacitors in your circuit (It's not on your schematics)? If not then it may not be running stable causing these types of errors.
hiduino:
Do you have any decoupling capacitors in your circuit (It's not on your schematics)? If not then it may not be running stable causing these types of errors.
Yes sorry just a mistake that I forgot to put it in the schematics I uploaded here. I have one 100nF close to the MCU between it and the ISP connector.
C:\Program Files (x86)\arduino-1.0.4\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\arduino-1.0.4\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cusbasp -Pusb -Uflash:w:C:\Program Files (x86)\arduino-1.0.4\hardware\arduino\bootloaders\stk500v2\stk500boot_v2_mega2560.hex:i -Ulock:w:0x0F:m
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\arduino-1.0.4\hardware/tools/avr/etc/avrdude.conf"
Using Port : usb
Using Programmer : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
AVR Part : ATMEGA2560
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : usbasp
Description : USBasp, http://www.fischl.de/usbasp/
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9801
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "C:\Program Files (x86)\arduino-1.0.4\hardware\arduino\bootloaders\stk500v2\stk500boot_v2_mega2560.hex"
avrdude: writing flash (261406 bytes):
Writing | ################################################## | 100% 142.63s
avrdude: 261406 bytes of flash written
avrdude: verifying flash memory against C:\Program Files (x86)\arduino-1.0.4\hardware\arduino\bootloaders\stk500v2\stk500boot_v2_mega2560.hex:
avrdude: load data flash data from input file C:\Program Files (x86)\arduino-1.0.4\hardware\arduino\bootloaders\stk500v2\stk500boot_v2_mega2560.hex:
avrdude: input file C:\Program Files (x86)\arduino-1.0.4\hardware\arduino\bootloaders\stk500v2\stk500boot_v2_mega2560.hex contains 261406 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 137.52s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x1e000
0xff != 0x0d
avrdude: verification error; content mismatch
avrdude done. Thank you.
Symtomps are as before, code seems to not run if the sketch is uploaded through the programmer anyway. I now have a working board again (after some fuse issues..) so give me all your suggestions. What is the best way to confirm that code is even executing?
I tested the same USBasp programmer LCsoft Studio on my Arduino Mega2560 and sure enough it also fail verification. It appears the firmware on your USBasp programmer doesn't properly support the larger memory space on the 2560.
I did have another LCsoft Studio programmer that I upgrade to the 2011-05-28 firmware and it was successful on the verification test. So this works! An added benefit is that it also programs almost twice as fast.
hiduino:
I tested the same USBasp programmer LCsoft Studio on my Arduino Mega2560 and sure enough it also fail verification. It appears the firmware on your USBasp programmer doesn't properly support the larger memory space on the 2560.
I did have another LCsoft Studio programmer that I upgrade to the 2011-05-28 firmware and it was successful on the verification test. So this works! An added benefit is that it also programs almost twice as fast.
Sound great, is the programmer that worked an identical USBasp programmer? Should I configure one of my arduino boards to update my USBasp programmer immediately or do I have to buy another model of programmer?
Could you run the sketches or bootloader with the first one who fail the verification? I have tried to upload through another software, a small firmware i wrote in AVRStudio and it gives a verification error even though the code is less than 20 rows, it seems to fail verification even though I doesn't use a lot of memory?
Yes, actually, I was able to upload sketches even though it failed the bootloader verification.
To update the programmer's firmware you do need another programmer. However, you can use ArduinoISP as the programmer. So if you have a spare Uno just load the ArduinoISP sketch to it. You just need to connect up the Uno pins to the corresponding pins on the USBasp 10-pin header. Note you don't need the 10uF capacitor that some documentation says is needed to disable the auto-reset.
Then you will need to jumper J2 on your USBasp programmer. This will connect the programmers ATmega8A reset to the 10-pin header reset. I soldered a 2-pin header to mine, so I could jumper it easily.
I programmed it from avrdude on command line. Change the COM port to your Uno.
Hi, so far I've tried the command line you wrote above which made it complain that it couldn't find the "wide configuration file".
If I gave it the path to the one in arduino (I only have AVRdude through Arduino) it stood for a few second and than gave me the error "stk500_getsync(): not in sync: resp=0x00". What am I doing wrong here?
Thanks for your feedback, did your firmwares run on the platform even though you got the verification fail error?
Cheers
Yes, on mine the arduino bootloader was installed correctly, even though the error message appeared.
Have you tried to upload an arduino sketch via serial?
bigal83:
If I gave it the path to the one in arduino (I only have AVRdude through Arduino) it stood for a few second and than gave me the error "stk500_getsync(): not in sync: resp=0x00". What am I doing wrong here?
Looks like you may have specified the wrong COM# port. It should be whatever your Uno show up under in the IDE Tools->Serial Port menu.
Thanks, I'll try that later. Is that a sketch that you put on one adruino board to program a bootloader to another board? Specifically made for ATMega2560 it looks like?