Go Down

Topic: How to burn bootloader on Atmega8? (Read 4115 times) previous topic - next topic

kaor

Nick Gammon, verification error means that bytes written doesn't mach bytes read (read was FF, therefore there is nothing written), I hasn't dig into that sketch yet, so don't sure what causes that error.

westfw, that's interesting, I'll try.
Should I always put exact speed supposing that lower speed won't work?
?????? ?????? ?????, ??? ??? - ??????????!

westfw

Quote
Should I always put exact speed supposing that lower speed won't work?

Yes.  None of the bootloaders suppor any form of bitrate detection.  You have to talk to them at the exact bitrate that they were compiled to accept (possibly taking into account changes in clock rate.  optiboot is designed to run at 115200bps at 16MHz;  If you run that same code on an 8MHz cpu, it will go (exactly) 57600 (half the clock rate, half the bitrate.))

Compiling the bootloader to accept a lower bitrate MIGHT improve reliability of uploads, IF certain types of error are involved...

kaor

#17
Oct 18, 2012, 08:35 pm Last Edit: Oct 18, 2012, 08:38 pm by kaor Reason: 1
I'm success now, but I don't know why :D
Anyway, thanks to westfw for the hint.
What I did:
I've tried 57600 serial rate with optiloader bootloader uploaded, and received another error
Quote

Binary sketch size: 918 bytes (of a 7,168 byte maximum)
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

I suppose there is problem with lock bits.
Anyway, than I've tried Arduino standard bootloader
Code: [Select]

atmega8bb.bootloader.path=arduino:atmega8
atmega8bb.bootloader.file=ATmegaBOOT.hex

Uploaded via ArduinoISP sketch using Arduino IDE tool (burn bootloader).
After upload, I've played with several rates for sketch uploading and got success with 9600.
But receiving again the same error about invalid signature.
Than I tried old IDE 0022 version and it worked :))) I suppose it uses that "-F" switch for avrdude for overriding signature or lock bits.
?????? ?????? ?????, ??? ??? - ??????????!

kaor

BTW, I tried noxtal bootloader http://todbot.com/blog/2009/05/26/minimal-arduino-with-atmega8/
And none of serial rates worked. They say serial speed 38400 should work, but it doesn't, neither any other speed from 2400 to 57600.
?????? ?????? ?????, ??? ??? - ??????????!

Nick Gammon


Nick Gammon, verification error means that bytes written doesn't mach bytes read (read was FF, therefore there is nothing written), I hasn't dig into that sketch yet, so don't sure what causes that error.


Try changing the line:

Code: [Select]

  SPI.setClockDivider (SPI_CLOCK_DIV64);


to:

Code: [Select]

  SPI.setClockDivider (SPI_CLOCK_DIV128);
Please post technical questions on the forum, not by personal message. Thanks!

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

kaor

Nick Gammon, actually I've pass bootloading step and now working on sketch uploading, anyway I'll check it when I have a time.
?????? ?????? ?????, ??? ??? - ??????????!

kaor



Nick Gammon, verification error means that bytes written doesn't mach bytes read (read was FF, therefore there is nothing written), I hasn't dig into that sketch yet, so don't sure what causes that error.


Try changing the line:

Code: [Select]

  SPI.setClockDivider (SPI_CLOCK_DIV64);


to:

Code: [Select]

  SPI.setClockDivider (SPI_CLOCK_DIV128);




Didn't help.
Here is the serail output
Quote

Entered programming mode OK.
Signature = 0x1E 0x93 0x07
Processor = ATmega8A
Flash memory size = 8192 bytes.
LFuse = 0xD4
HFuse = 0xCA
EFuse = 0xFF
Lock byte = 0xCF
Clock calibration = 0xC3
Bootloader address = 0x1C00
Bootloader length = 1024 bytes.
Type 'V' to verify, or 'G' to program the chip with the bootloader ...
Erasing chip ...
Writing bootloader ...
Committing page starting at 0xE00
Committing page starting at 0xE20
Committing page starting at 0xE40
Committing page starting at 0xE60
Committing page starting at 0xE80
Committing page starting at 0xEA0
Committing page starting at 0xEC0
Committing page starting at 0xEE0
Committing page starting at 0xF00
Committing page starting at 0xF20
Committing page starting at 0xF40
Committing page starting at 0xF60
Committing page starting at 0xF80
Committing page starting at 0xFA0
Committing page starting at 0xFC0
Committing page starting at 0xFE0
Written.
Verifying ...
Verification error at address 1C00. Got: 0xFF  Expected: 0x12
Verification error at address 1C01. Got: 0xFF  Expected: 0xC0
...  ...
Verification error at address 1D80. Got: 0xFF  Expected: 0x1D
239 verification error(s).
First 100 shown.
Type 'C' when ready to continue with another chip ...



?????? ?????? ?????, ??? ??? - ??????????!

kaor

Still have one problem, can't upload from Arduino IDE 1 (either 1.0.1) version.
IDE 0022 works great.
?????? ?????? ?????, ??? ??? - ??????????!

Nick Gammon

This doesn't look right:

Code: [Select]

Writing bootloader ...
Committing page starting at 0xE00
Committing page starting at 0xE20
...
Committing page starting at 0xFE0
Written.
Verifying ...
Verification error at address 1C00. Got: 0xFF  Expected: 0x12
Verification error at address 1C01. Got: 0xFF  Expected: 0xC0
...


It's writing at 0xE00 but verifying at 0x1C00. Let me look into that.
Please post technical questions on the forum, not by personal message. Thanks!

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

Nick Gammon

Looks like the address difference was just a display issue.

I can't explain your difficulty right now. I don't have an Atmega8 chip to hand to test my bootloader uploader with.
Please post technical questions on the forum, not by personal message. Thanks!

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

westfw

BTW, I'm reminded that 1.0 introduced a bug in ArduinoISP; I keep forgetting because it's one of the bugs that's actually been fixed in 1.0.1
If you're still using 1.0, you should upgrade or apply one of the patches!
http://code.google.com/p/arduino/issues/detail?id=860

kaor

#26
Oct 20, 2012, 08:00 am Last Edit: Oct 20, 2012, 08:05 am by kaor Reason: 1
westfw, I'm using thje last version 1.0.1
btw, I copied the hardware\tools\avr\bin folder from 0022 to 1.0.1 , also copied avrdude.conf file and now 1.0.1 IDE is able to upload sketches to my Atmega8.

Before I was receiving
Quote

Binary sketch size: 2,288 bytes (of a 7,168 byte maximum)
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.
?????? ?????? ?????, ??? ??? - ??????????!

kaor

p.s.
Copying just avrdude.exe instead of whole bin folder also helps.
?????? ?????? ?????, ??? ??? - ??????????!

Go Up