Go Down

Topic: ArduinoISP Arduino uno & blank atmega8 bootloader burn trouble (Read 8605 times) previous topic - next topic

Nick Gammon


tell you what Nick, you gave me a hell of a step in the right direction, plugging the crystal in and whatever capacitors im using(22j ceramic) which im guessing are the 22pico i needed read the chip found out yea it has a bootloader on it, im gonna try all i can to get this to work now, and thank you very much for having so much patients with me even tho my attitude was less than deserving of it, and i saw how busy you were helping everyone else, i really do appreciate everything you've done


Glad to hear you are getting closer. You could take the fuse readings it would have provided and compare to the calculator here:

http://www.engbedded.com/fusecalc

That might give a few clues. If the divide-by-8 fuse is set, then the bootloader might not work properly.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

mysteredding


Glad to hear you are getting closer. You could take the fuse readings it would have provided and compare to the calculator here:

http://www.engbedded.com/fusecalc

That might give a few clues. If the divide-by-8 fuse is set, then the bootloader might not work properly.
i get this when i upload board programmer
Binary sketch size: 24,068 bytes (of a 32,256 byte maximum)
avrdude: verification error, first mismatch at byte 0x2180
         0xff != 0x27
avrdude: verification error; content mismatch
and i cant find any mention of it in either tutorial

mysteredding

i also got this when i open serial moniter
Code: [Select]
Entered programming mode OK.
Signature = 0x1E 0x93 0x07
Processor = ATmega8A
Flash memory size = 8192 bytes.
LFuse = 0xBF
HFuse = 0xCC
EFuse = 0xFF
Lock byte = 0xFF
Clock calibration = 0xB3
Bootloader address = 0x1C00
Bootloader length = 1024 bytes.
Type 'V' to verify, or 'G' to program the chip with the bootloader ...(i typed g)
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x1C00
Committing page starting at 0x1C40
Committing page starting at 0x1C80
Committing page starting at 0x1CC0
Committing page starting at 0x1D00
Committing page starting at 0x1D40
Committing page starting at 0x1D80
Committing page starting at 0x1DC0
Committing page starting at 0x1E00
Committing page starting at 0x1E40
Committing page starting at 0x1E80
Committing page starting at 0x1EC0
Committing page starting at 0x1F00
Committing page starting at 0x1F40
Committing page starting at 0x1F80
Committing page starting at 0x1FC0
Written.
Verifying ...
Verification error at address 1C00. Got: 0xFF  Expected: 0x12
Verification error at address 1C01. Got: 0xFF  Expected: 0xC0
Verification error at address 1C02. Got: 0xFF  Expected: 0x2B
Verification error at address 1C03. Got: 0xFF  Expected: 0xC0
Verification error at address 1C04. Got: 0xFF  Expected: 0x2A
Verification error at address 1C05. Got: 0xFF  Expected: 0xC0
Verification error at address 1C06. Got: 0xFF  Expected: 0x29
Verification error at address 1C07. Got: 0xFF  Expected: 0xC0
Verification error at address 1C08. Got: 0xFF  Expected: 0x28
Verification error at address 1C09. Got: 0xFF  Expected: 0xC0
Verification error at address 1C0A. Got: 0xFF  Expected: 0x27
Verification error at address 1C0B. Got: 0xFF  Expected: 0xC0
Verification error at address 1C0C. Got: 0xFF  Expected: 0x26
Verification error at address 1C0D. Got: 0xFF  Expected: 0xC0
Verification error at address 1C0E. Got: 0xFF  Expected: 0x25
Verification error at address 1C0F. Got: 0xFF  Expected: 0xC0
Verification error at address 1C10. Got: 0xFF  Expected: 0x24
Verification error at address 1C11. Got: 0xFF  Expected: 0xC0
Verification error at address 1C12. Got: 0xFF  Expected: 0x23
Verification error at address 1C13. Got: 0xFF  Expected: 0xC0
Verification error at address 1C14. Got: 0xFF  Expected: 0x22
Verification error at address 1C15. Got: 0xFF  Expected: 0xC0
Verification error at address 1C16. Got: 0xFF  Expected: 0x21
Verification error at address 1C17. Got: 0xFF  Expected: 0xC0
Verification error at address 1C18. Got: 0xFF  Expected: 0x20
Verification error at address 1C19. Got: 0xFF  Expected: 0xC0
Verification error at address 1C1A. Got: 0xFF  Expected: 0x1F
Verification error at address 1C1B. Got: 0xFF  Expected: 0xC0
Verification error at address 1C1C. Got: 0xFF  Expected: 0x1E
Verification error at address 1C1D. Got: 0xFF  Expected: 0xC0
Verification error at address 1C1E. Got: 0xFF  Expected: 0x1D
Verification error at address 1C1F. Got: 0xFF  Expected: 0xC0
Verification error at address 1C20. Got: 0xFF  Expected: 0x1C
Verification error at address 1C21. Got: 0xFF  Expected: 0xC0
Verification error at address 1C22. Got: 0xFF  Expected: 0x1B
Verification error at address 1C23. Got: 0xFF  Expected: 0xC0
Verification error at address 1C24. Got: 0xFF  Expected: 0x1A
Verification error at address 1C25. Got: 0xFF  Expected: 0xC0
Verification error at address 1C26. Got: 0xFF  Expected: 0x11
Verification error at address 1C27. Got: 0xFF  Expected: 0x24
Verification error at address 1C28. Got: 0xFF  Expected: 0x1F
Verification error at address 1C29. Got: 0xFF  Expected: 0xBE
Verification error at address 1C2A. Got: 0xFF  Expected: 0xCF
Verification error at address 1C2B. Got: 0xFF  Expected: 0xE5
Verification error at address 1C2C. Got: 0xFF  Expected: 0xD4
Verification error at address 1C2D. Got: 0xFF  Expected: 0xE0
Verification error at address 1C2E. Got: 0xFF  Expected: 0xDE
Verification error at address 1C2F. Got: 0xFF  Expected: 0xBF
Verification error at address 1C30. Got: 0xFF  Expected: 0xCD
Verification error at address 1C31. Got: 0xFF  Expected: 0xBF
Verification error at address 1C32. Got: 0xFF  Expected: 0x10
Verification error at address 1C33. Got: 0xFF  Expected: 0xE0
Verification error at address 1C34. Got: 0xFF  Expected: 0xA0
Verification error at address 1C35. Got: 0xFF  Expected: 0xE6
Verification error at address 1C36. Got: 0xFF  Expected: 0xB0
Verification error at address 1C37. Got: 0xFF  Expected: 0xE0
Verification error at address 1C38. Got: 0xFF  Expected: 0xE8
Verification error at address 1C39. Got: 0xFF  Expected: 0xEE
Verification error at address 1C3B. Got: 0xFF  Expected: 0xE1
Verification error at address 1C40. Got: 0xFF  Expected: 0x0D
Verification error at address 1C41. Got: 0xFF  Expected: 0x92
Verification error at address 1C42. Got: 0xFF  Expected: 0xA2
Verification error at address 1C43. Got: 0xFF  Expected: 0x36
Verification error at address 1C44. Got: 0xFF  Expected: 0xB1
Verification error at address 1C45. Got: 0xFF  Expected: 0x07
Verification error at address 1C46. Got: 0xFF  Expected: 0xD9
Verification error at address 1C47. Got: 0xFF  Expected: 0xF7
Verification error at address 1C48. Got: 0xFF  Expected: 0x11
Verification error at address 1C49. Got: 0xFF  Expected: 0xE0
Verification error at address 1C4A. Got: 0xFF  Expected: 0xA2
Verification error at address 1C4B. Got: 0xFF  Expected: 0xE6
Verification error at address 1C4C. Got: 0xFF  Expected: 0xB0
Verification error at address 1C4D. Got: 0xFF  Expected: 0xE0
Verification error at address 1C4E. Got: 0xFF  Expected: 0x01
Verification error at address 1C4F. Got: 0xFF  Expected: 0xC0
Verification error at address 1C50. Got: 0xFF  Expected: 0x1D
Verification error at address 1C51. Got: 0xFF  Expected: 0x92
Verification error at address 1C52. Got: 0xFF  Expected: 0xAA
Verification error at address 1C53. Got: 0xFF  Expected: 0x36
Verification error at address 1C54. Got: 0xFF  Expected: 0xB1
Verification error at address 1C55. Got: 0xFF  Expected: 0x07
Verification error at address 1C56. Got: 0xFF  Expected: 0xE1
Verification error at address 1C57. Got: 0xFF  Expected: 0xF7
Verification error at address 1C58. Got: 0xFF  Expected: 0x4F
Verification error at address 1C59. Got: 0xFF  Expected: 0xC0
Verification error at address 1C5A. Got: 0xFF  Expected: 0xD2
Verification error at address 1C5B. Got: 0xFF  Expected: 0xCF
Verification error at address 1C5C. Got: 0xFF  Expected: 0xEF
Verification error at address 1C5D. Got: 0xFF  Expected: 0x92
Verification error at address 1C80. Got: 0xFF  Expected: 0x08
Verification error at address 1C81. Got: 0xFF  Expected: 0x07
Verification error at address 1C82. Got: 0xFF  Expected: 0x80
Verification error at address 1C83. Got: 0xFF  Expected: 0xE0
Verification error at address 1C84. Got: 0xFF  Expected: 0x18
Verification error at address 1C85. Got: 0xFF  Expected: 0x07
Verification error at address 1C86. Got: 0xFF  Expected: 0x28
Verification error at address 1C87. Got: 0xFF  Expected: 0xF0
Verification error at address 1C88. Got: 0xFF  Expected: 0xE0
Verification error at address 1C89. Got: 0xFF  Expected: 0x91
Verification error at address 1C8A. Got: 0xFF  Expected: 0x62
Verification error at address 1C8B. Got: 0xFF  Expected: 0x00
507 verification error(s).
First 100 shown.
Type 'C' when ready to continue with another chip ...

Nick Gammon

Do you have decoupling capacitors on Vcc? I had something similar a while back. You are communicating with the chip, but perhaps too fast to program it.

In my programming sketch, locate the line which says:

Code: [Select]
  // slow down SPI for benefit of slower processors like the Attiny
  SPI.setClockDivider (SPI_CLOCK_DIV64);


Try changing SPI_CLOCK_DIV64 to SPI_CLOCK_DIV128.

Re-upload that and see if that makes a difference.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

mysteredding


Do you have decoupling capacitors on Vcc? I had something similar a while back. You are communicating with the chip, but perhaps too fast to program it.

In my programming sketch, locate the line which says:

Code: [Select]
  // slow down SPI for benefit of slower processors like the Attiny
  SPI.setClockDivider (SPI_CLOCK_DIV64);


Try changing SPI_CLOCK_DIV64 to SPI_CLOCK_DIV128.

Re-upload that and see if that makes a difference.
i tried changing the code and re-uploading but no i didnt have decoupling capacitors attached, just put some in, and got a similar error, instead of 507 verification error(s). it had 235 verification error(s), so theres a difference but it also said the bootloader was 1024 instead of 512 like before

mysteredding


Try changing SPI_CLOCK_DIV64 to SPI_CLOCK_DIV128.
this
Code: [Select]
avrdude: verification error, first mismatch at byte 0x2180
        0xff != 0x27
is my main concern, and what i think is the cause of the 500+ errors to begin with see tho it uploads just fine and works when i look at chips but doesnt wanna work with me, im gonna try using my brothers windows vista tomorrow and see if it works cuz all i need is the bootloaders changed and test programming them later, and it seems the lower i set the spi_clock the higher the error numbers go i set it to 2 and came up with 700+ errors tried setting it to 256 but is not declared so wont compile, where would i go to declare it? and will it damage the chip at all?

Nick Gammon

#51
Nov 26, 2012, 04:33 am Last Edit: Nov 26, 2012, 04:35 am by Nick Gammon Reason: 1
Quote
it also said the bootloader was 1024 instead of 512 like before


It probably misread the fuse, that's why.

You need short cable runs, decoupling capacitors (0.1 uF) more or less as in my photo.

If it still doesn't work can you take a photo? I'd like to see what you are doing.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

I doubt it would damage it, unless it happened to set a strange fuse setting. Try speeding it up then.

The valid clock dividers are:

Code: [Select]

    SPI_CLOCK_DIV2
    SPI_CLOCK_DIV4
    SPI_CLOCK_DIV8
    SPI_CLOCK_DIV16
    SPI_CLOCK_DIV32
    SPI_CLOCK_DIV64 or
    SPI_CLOCK_DIV128
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

simplex


im gonna try using my brothers windows vista tomorrow and see if it works

This single line command in avrdude (under windows),

c:\>avrdude -P COM3 -b 19200 -c avrisp -p m8 -n

can tell you if you can communicate well with your atmega8 or not.

If the connections between Uno and the target Atmega8 are exactly as in the link I posted it should work from the first try, even without Crystal.

mysteredding

the days got awayfrom me and i think im gonna start from scratch but im gonna reload my OS before i do anything so i still have to wait before starting again

misplaced-texan

Hi - Having a similar problem on a Arduino Uno after about a week of use, I can't upload any new code.   

avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0xff

The details:
Arduino Uno
Arduino software 1.0.2

I have been reading the posts in this thread and have spent a couple of evenings on Google trying to find a solution.  Have tried the simple stuff (new cable, different computer, pressing the reset during compile).  I am trying to work through Nick Gammon's excellent tutorial on reburning the bootloader using a second Arduino.  Have downloaded the script http://gammon.com.au/Arduino/Atmega_Board_Programmer.zip and tried to compile in the Arduino environment and I get compile errors 'atmega168_optiboot' was not declared in this scope (see attached for verbose output.  Not sure where to go from here.  I think that I need to compile the Atmega_Board_Programmer script before I can upload to the new Arduino board and then flash to the original board.  Not sure how to get Arduino environment to do this.  Is there a better way?  My 20 years of experience is in mechanical engineering and the electronics world is new to me.

Thanks for any help!

Nick Gammon

I compiled it without errors just then. You need to keep all the files together in the folder (don't copy the .ino somewhere else). Then the IDE will include all those .h files in the project.

This is how the IDE should look after you open the project (it's a fairly wide image):



Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

misplaced-texan

Closer, but.......

OK, I got Atmega_Board_Programmer to compile, but it won't upload to the new Arduino Uno.  I get this when I try to upload using the Arduino environment:

Binary sketch size: 24,106 bytes (of a 32,256 byte maximum)
avrdude: verification error, first mismatch at byte 0x2180
         0xff != 0xb8
avrdude: verification error; content mismatch

I have tried different baud rates, cables and com ports.  I CAN upload other sketches to the new Arduino like blink without issue.


Looking at one of your other posts and trying this script to talk to the new Arduino, I get
avrdude -P COM3 -b 19200 -c avrisp -p m8 -n

avrdude: stk500_getsync<>:not in sync: resp=0x30

What are my next steps? 

Tom

Nick Gammon

How many Arduinos do you have? The idea is to load my sketch onto an existing one and use that to program your new device. Skimming back through the thread, I got the impression it isn't the Uno you are having trouble programming.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

misplaced-texan

OK - Sorry for the confusion, here is what I have.

1 - Arduino Uno with what seems to be a corrupt bootloader.  It is a couple of weeks old and I have been able to upload sample code from the Arduino examples without issue over the past couple of weeks.  A couple of days ago, it stopped accepting any new code.  It gives this error.
avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0xff

The details:
Arduino Uno
Arduino software 1.0.2

2 - Aduino Uno NEW out of the box that I purchased to use with your tutorial Atmega_Board_Programmer.  I can load sample code from the Arduino site without issue to this Uno.  After your suggestion of 12/5, I can get your code to compile in the Arduino 1.0.2 software, but it will not upload to the NEW Uno.  It gives this error message

Binary sketch size: 24,106 bytes (of a 32,256 byte maximum)
avrdude: verification error, first mismatch at byte 0x2180
         0xff != 0xb8
avrdude: verification error; content mismatch


I am not sure what to try next.  Any suggestions would be appreciated.

Thanks

Go Up