Atmega8 doing well in Arduino board but not on breadboard - want to avoid quartz

Hello and sorry if my problem has been answered before. I have written a sketch that moves 4 servos according to 4 analog inputs and it's working fine on my arduino uno. I used the Arduino uno to burn the bootloader to a breadboard-ATmega8, then I plugged the ATmega8 in the Arduino board and I burned the software to the Atmega8 using the arduino-board, in tools-board I choose "Arduino NG or older with ATmega8". The sketch works like it should as long as the ATmega is in the Arduino-board, but when in the breadboard the servos don''t move any more - I checked all wires and the electrical setup according to http://arduino.cc/en/Hacking/PinMapping?from=Main.PinMapping and now I think I might face a timing problem. And I need help. Thanks! Regards C.

  • ok, plugged a 16MHZ Quartz to pins 9 and 10 of the ATmega8 and now it works on the breadboard. Is there anything I can do to make it work without the quartz?
    Thanks!
    C.

You need to change the low fuse bits to internal 8MHz clock instead of external crystal. You can edit the boards.txt file under the install \arduino-1.0.6\hardware\arduino.

Change this line to:

atmega8.bootloader.low_fuses=0xE4

Put the mega8 back in your Uno, then restart the IDE and re-burn bootloader for the Arduino NG. This should change it to internal 8MHz clock. Then re-upload your sketch. This should work now in your breadboard.

Thank you Hiduino, I had to allow me to change the boards.txt file (could not save it before...), then I re-burned the bootloader of the ATmega8 on the breadboard (http://pdp11.byethost12.com/AVR/ArduinoAsProgrammer.htm), plugged it back in the Uno, burned my sketch, upload was finished, I had a message "avrdude. stk500_getsync(): not in sync: resp=0x00" but the Atmega8 back on the breadboard moves the servos just fine now without the quartz. The only thing that made me wonder was the fact, that the ATmega takes about 15 seconds until it works. I can live with that but it was irritating at first. Thanks again Hiduino, best wishes C.

Changing fuses to internal 8mhz requires another bootloader if you want to program it via usb. common optiboots are for 16mhz external osc, you have to find one for 8mhz internal osc. If I were you I'd just upload with isp programmer.

To disable the 15 seconds wait, erase the flash on atmega8 (erase bootloader which is the cause of the wait) and then upload sketches with external isp programmer.

First of all, a bit off-topic: great to get answers from all around the world :-) Answers from Hawaii and Chile for someone asking in Austria is remarkable. Mart256, I'll have to ask google to really understand your answer. The ATmega8 is doing what it should now, the 15 seconds delay seem a bit long, yes. I have no experience with microcontrollers other than doing simple sketches with the arduino, so plugging the chip in the board or connecting pins using some wires on the breadboard is what I am able to do now. But mart256 - you think I can use the Arduino Uno as "external isp programmer"? (like described here: http://pdp11.byethost12.com/AVR/ArduinoAsProgrammer.htm) And I have no idea how to erase the bootloader from the Atmega8... (You see; I'm a complete noob, sorry...) Thanks, best wishes C.

Yes, Arduino UNO can be an ISP programmer. To erase bootloader (erase 15 secs) I'm afraid you'll need to use avrdude commands and erase memory, but then you'll be able to upload only with Arduino as ISP.

claudio: you think I can use the Arduino Uno as "external isp programmer"? (like described here)? And I have no idea how to erase the bootloader from the Atmega8... (You see; I'm a complete noob, sorry...)

We believe the best reference is Nick's tutorial - thought that other one seems to be reasonably comprehensive.

Thanks Paul, I did not know Nick’s tutorial yet, it offers lots of information. And great to have an answer from just another continent :slight_smile:
Best wishes
C. (hopefully receiving the motors soon, so I can build the hardware part of my project)