Pages: 1 [2]   Go Down
Author Topic: How to burn bootloader on Atmega8?  (Read 3411 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6374
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm success now, but I don't know why smiley-grin
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:
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 smiley)) I suppose it uses that "-F" switch for avrdude for overriding signature or lock bits.
« Last Edit: October 18, 2012, 01:38:50 pm by kaor » Logged

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  SPI.setClockDivider (SPI_CLOCK_DIV64);

to:

Code:
  SPI.setClockDivider (SPI_CLOCK_DIV128);
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
  SPI.setClockDivider (SPI_CLOCK_DIV64);

to:

Code:
  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 ...


Logged

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This doesn't look right:

Code:
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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6374
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: October 20, 2012, 01:05:11 am by kaor » Logged

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

Offline Offline
Full Member
***
Karma: 1
Posts: 141
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

p.s.
Copying just avrdude.exe instead of whole bin folder also helps.
Logged

რასაცა გასცემ შენია, რაც არა - დაკარგულია!

Pages: 1 [2]   Go Up
Jump to: