Go Down

Topic: Install Bootloader to use 8Mhz internal resonator - and upload program after? (Read 2360 times) previous topic - next topic


I've been trying to get a super-minimal arduino going. I followed instructions in the following:


I've got the "ATmega328 on a breadboard (8 MHz internal clock)" board available, which, after some fiddling about contains this:
Code: [Select]

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)


# internal osc: E2 / D9 / 07
# external: FF / DA / 05


This seems to install correctly, the LED on pin 13 blinks after burning. The thing is, after doing that, I can't upload my sketch to the chip. I keep getting:

avrdude: stk500_recv(): programmer is not responding

I'm doing all of this on a duemilanove board, with an atmega328 (arduino-0018 on linux), and burning bootloaders with a USBtinyISP. I think it's possible the chip does start working with the 8Mhz oscillator, but programming doesn't work because there's a serial port speed problem.

So my question is... has anyone ever got this going, and what boards.txt settings do I need?


Try this :

Press Upload
Wait for sketch size

Hope this solves your issues

http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly


Thanks for the tip, but that doesn't work either. It looks like the board is automatically resetting on upload anyway, but even throwing in a manual one doesn't seem to work.

I've seen notes about calibrating the resonator for serial, which I'd really like to avoid if possible. However, I've tried setting the upload baud rate to other values (down to 9600) which didn't seem to work either. Is it possible that the speed negotiation is failing because it's miscalibrated at the chip end? Is there a way to burn a bootloader that only listens at 9600 or something?


Herein lies the reason I gave up to running a homebrew arduino at anything other than 16 Mhz.

The addition of a cheap 16 Mhz resonator saves acres of grief......



One thought... is it possible to upload a program to the chip using my USBtinyISP burner? If I could do that, I could probably just do that to get my code onto the chip and avoid the serial port altogether (although I guess it would probably work at 9600, if I needed it for debug). This probably isn't a decent solution for everyone though...


Gotta say...tapping reset at just the right moment never worked for me.  I agree with the poster who says to just use the caps and oscillator and use the chip that way.  It isn't that big a deal to include them in the circuit and saves some grief.  I did however resort to uploading the program using an arduino, popping the chip out and sticking it into my breadboard- it worked.  Never did resolve the uploading directly to the breadboarded chip issue.


This appears to be pointing to "use a crystal", but that's a shame because it seems silly to put in a 16Mhz crystal and scale it down to 8Mhz (or less), especially as there's an 8Mhz oscillator right there in the chip, which would save a few (admittedly cheap) components. That said, any advantage is lost if it doesn't work!!

On the matter of tapping reset, I have made this work successfully on a breadboard (so long as I have a nice 16Mhz crystal!). I'm not sure if it's the secret of my success, but a pull-up resistor on the reset pin seems to be useful, and then just tap it with a grounded wire.

All that said, getting the program onto the chip by USBtinyISP could solve a few other problems, so it's still something I'd like to do (regardless of what clocking I end up with).

Coding Badly

It does work.  But it requires some effort from you.

The internal oscillator is tuned to ±10% from the factory.  At about ±4.5% serial communications stops working reliably.  The oscillator can be easily tuned ±1%.  To get your Sketch running at the calibrated value is trivial.  This single line of code is all that needs to be added to setup...

  OSCCAL = TuningValueForThisProcessor;

The problem is that the bootloader needs to do the same thing; set the OSCCAL register.


I have several projects with 'bare' ATmega168 chips that happily run on the internal RC oscillator and 'optiboot_pro_8MHz.hex' works quite ok with these. There are some chips that don't accept uploads on the first try though. Warming them up a bit seems to help. Changing the OSCAL registers might help, but it changes with temperature anyway.

If you need async (uart) inter-board communication, better use a quartz.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!


Thanks for the info guys. I'll hack about a bit more (mostly for curiosity). I think the answer seems to be that for "safety"/simplicity having a crystal seems to be the best thing to do. Whilst I probably only need serial at 9600 (and even then only rarely), I don't want to have to wait for the chip to warm up before programming or whatever.

Thanks everyone for your inputs - it's been really useful.


Isn't the bootloader you're using compiled to run at 16MHz?  I only have experience with Optiboot, but it looks like there's an 8MHz version of ATmegaBOOT supplied with IDE v0022.  Try changing these two lines in boards.txt:



Not sure how I missed that one, but either way, it doesn't seem to work either. Looks like I'm  out of luck :-(

Caliber Mengsk

Anyone figure this out fully?

I ask because I'm working on trying to make a 1inx1in arduino circuit using the 328p (smd), and while I have all 20 output pins, and it could be programmed through ftdi and a breadboard, I forgot to put in a crystal, and after diodes, voltage regulator and capacitors for the vreg, I'm out of space. Using the internal 8mhz would be amazing. Unfortunately, I have absolutely no place left for the crystal, as it was tricky just getting all 20 pins, 4 grounds, and the input voltage/ground on the circuit with the limitations of the pcb process sizes (I use 8mil spacing to be safe)


What is the problem ;-)

I do this on a regular basis with ATmega168 chips using the 8MHz optiboot running at 115200. And it even works most of the time.

Code: [Select]

RGBLedRing2.name=RGB LED RING - ATmega168 / 8MHz RC OSC / optiboot Bootloader

You'll have to adjust the fuse-settings, target and maximum_size. And don't forget the 100nF capacitor and 10k pull-up on the reset line to make the auto-reset work.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131