Bootloader doesn't work with internal oscillator

Good day!

I've two Atmega8A on a breadboard:

I can program both using ArduinoISP. I can burn bootloader with Arduino IDE or any other code using plain avrdude, so I know that chips work.

Than I pull out the chip from Arduino and connect my breadboard chips like this: http://arduino.cc/en/uploads/Tutorial/ArduinoUSBSerialSimple.png (int.osc) or this: http://arduino.cc/en/uploads/Tutorial/ArduinoUSBSerial.png (ext.osc) Additionally I add wire from reset on Arduino to reset on a breadboard chip to reset using DTR drop.

With this setup chip with external crystal works, but with internal -- not, I get the following error:

avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: Send: Q [51] [20]

Thanks in advance!

What speed external oscillator are you using?

External crystal is 16Mhz (the same as standard Arduino), the internal is 8Mhz. I think that problem is in modified bootloader, because chip with internal osc. work right when programming using ISP.

NOT IN SYNC = Bad RS232 Communication.

It looks to me like you need CROSS your wires. TX-RX It looks like you have TX going to TX and RX going to RX. (Whch usually does not work... with serial coms)

Have you considered the fact that a bootloader binary is speed dependant? That is if you prepare a chip with a 16MHz bootloader, it wil not run as expected at 8MHz.

Have you considered the fact that a bootloader binary is speed dependant? That is if you prepare a chip with a 16MHz bootloader, it wil not run as expected at 8MHz.

Yep, I use modified bootloader and boards.txt for chip which runs on 8Mhz, the bootloader and boards.txt snippet is here: http://todbot.com/blog/2009/05/26/minimal-arduino-with-atmega8/

Did you set the fuses?

Yes, I set fuses when I burn a bootloader, because they are listed in boards.txt snippet in the link above:

atmega8noxtal.bootloader.low_fuses=0xe4 atmega8noxtal.bootloader.high_fuses=0xc4

I can read back this fuses using ArduinoISP.

I can program this chip using ArduinoISP and avrdude too.

Strange :(

Two things...

  1. 256 words (512 bytes) for the bootloader seems a bit small. You should confirm that the bootloader really does fit in that space.

  2. The internal oscillator is guarenteed to be accurate to ±10%. Around 4.5% serial communications is not going to work very well. Past 4.5% serial communications is simply not going to work. Have you calibrated the oscillator? Have you checked the calibration on the oscillator?

Thank you a lot! :)

The fuses settings in the article are wrong, the bootloader takes 1kb, not 512bytes, so correct fuses are

atmega8noxtal.bootloader.low_fuses=0xe4 atmega8noxtal.bootloader.high_fuses=0xc2

After correction it works!

Can you point me to any good tutorial on calibrating oscillator having only Arduino with 328P and bare ATmega8A chip on a breadboard.

I've had success with this... http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287558192

Thank you for the tutorial, btw my particular chip can do serial on 38400 without calibration (normal temp around +25 C).

Thank you again that point wrong fuses settings, I've struggled with this for about a week, but forget to check if fuses are set correct in the tutorial I follow :)

Thank you for the tutorial,

You are welcome.

Thank you again that point wrong fuses settings, I've struggled with this for about a week, but forget to check if fuses are set correct in the tutorial I follow

Thank you for posting the final results. There's a good chance that your follow-up will help someone else.

I've posted bugreport to the comments on this site, this article is quite popuplar, hope this will save some time for somebody:

Tod, I've the same bugreport as the person above :)

“Also, for me the fuses that worked were low=0xE4 and high=0xC2

http://www.engbedded.com/fusecalc is a truly wonderful tool for decoding and experimenting with these.

The difference between xC2 and xC4 is the assertion for how large the bootloader space is, I think? If so, I think 0xC2 is what you want (512 words 0xC2, rather than 256 words for 0xC4)”

It seems to be an error in boards.txt snippet — the bootloader is 1K, not 0,5Kb. I've figured out with great help from Arduino forums: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1289168254/13#13

Can you update, so this will save other people some time (one week for me :)).