AtMega328 with Internal 8MHz Oscillator Questions

I used this guide to burn the bootloader for the use of an ATmega328 with the internal 8MHz oscillator. http://arduino.cc/en/Tutorial/ArduinoToBreadboard
It burned without a problem and then I hooked it up to program the chip. I took the chip I had in my arduino and connected up the TX and RX. When I tried to program the board with my code, I got the
stk500_getsync():not in sync:resp=0x00
stk500_disable():protocol error, expect=0x14, resp=0x51
errors. I have the correct board selected and the right com port

Also, the prototype of my device is set up to use a 16MHz external oscillator since I'm having trouble getting the internal one to work. If I do get the 8MHz clock working, would I need to disconnect the external 16MHz clock? or could I leave it connected and the atmega would just know to use the internal resonator?

Any info will help! Thank you!

I have the correct board selected and the right com port

Did you install an 8 MHz bootloader?

If I do get the 8MHz clock working, would I need to disconnect the external 16MHz clock?

I didn't need to.

or could I leave it connected and the atmega would just know to use the internal resonator?

That worked for me.

Yes, I added the 8MHz board folder to my hardware folder, uploaded the Arduino ISP to my arduino board, selected the 8MHz atmega328 as the board, selected burn bootloader>ArduinoISP. It went through without error. I disconnected everything and just hooked up the minimal circuit to program the chip with my code, and it just hangs and gives me that error.

hooked up the minimal circuit to program the chip with my code

An FTDI adapter?

Have you ever used AVRDUDE from the command-line?

I have never used AVRDUDE from command line. The minimal circuit is in the link I shared in my first post. Basically power the chip, hook up the TX and RX lines from my arduino, take the chip out of my arduino so it only talks to the one on the breadboard (that theoretically has the internal oscillator set) and is powered by the arduino.

Some of the fuse settings are questionable (like disabling the brown-out detector) but they are certainly correct for an internal 8 MHz processor clock.

I have no idea what could be wrong. As far as I can tell, you're doing everything you should be.

Can you connect an LED + resistor to pin 13? I believe the bootloader will blink the LED while it waits for a connection. Yoiu'd at least know if the bootloader is trying.

I'm having exactly the same problem as Dandeman321 . . .

  • the lilypad 328 bootloader burns fine
  • the led on pin 13 is flashing as normal after burning the bootloader
  • afterwards, I can't load a sketch to the chip
    stk500_getsync():not in sync:resp=0x00
    stk500_disable():protocol error, expect=0x14, resp=0x51
    (using the same board setting as when burning the bootloader)

It's strange. I've done this several times in the past, and I even tried it on IDE Rel 17 which worked for me then. (using Rel. 21 now)

If I re-burn the bootloader back to 16MHz I can load programs again.

I'm stuck! :cry: If anyone has a suggestion, I'd appreciate it.

If I re-burn the bootloader back to 16MHz I can load programs again.

Just to make certain I understand...

When running at 16 MHz, you're using a crystal?

The processor is a 328?

You're using the Arduino IDE to burn the Lilypad bootloader?

Everything right except for the bootloader. It's a special one that was released from arduino. In the initial link I posted, you can find it.

Coding Badly, thanks

When running at 16 MHz, you're using a crystal?

Yes, the crystal is also connected when trying to run at 8MHz. I didn't think it mattered, but maybe it does after all? (Something to try)

The processor is a 328?
You're using the Arduino IDE to burn the Lilypad bootloader?

Yes to both. The Lilypad 328 bootloader.

BTW, I did try the the new "ATmega328 on a breadboard (8 MHz internal clock)" (but only once), and I got errors while loading that bootloader. However, I should try it again to be sure.

@Dandeman321:

Did you get the processor + bootloader to work running from the internal oscillator?

Nope

I don't know why I didn't think of this earliear but the problem could simply be that the processor needs to be tuned. If either of you would like, I will prepare a test to determine if that is the problem.

Tuned? At this point, the project I was working on has been taken over by another individual. You don't have to bother with setting up a test. Thanks for the offer though!

Tuned?

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287558192

I guess I'm game. But wouldn't it be a chicken and egg thing? i.e. Since I can't load a sketch at 8MHz, how would the value from the tune get set so that I could load a sketch? (or am I missing something?)

I assume, since it's not an ATtiny, I'd need to use the "template"?

I guess I'm game.

Excellent.

But wouldn't it be a chicken and egg thing? i.e. Since I can't load a sketch at 8MHz, how would the value from the tune get set so that I could load a sketch? (or am I missing something?)

If you can install a bootloader you can use the same path to install a Sketch.

I assume, since it's not an ATtiny, I'd need to use the "template"?

I'm not certain. I know it's only been a few months since I released Tiny Tuner but I honestly can't remember how to extend it to other processors. I'll take a look at that tonight or tomorrow night.

The hurdles you will have to overcome are...

  • Determine that the oscillator really is too far from 8 MHz for the serial port to work
  • Determine the optimal value for the OSCCAL register
  • Modify the bootloader to load the OSCCAL register
  • Install the modified bootloader

Still interested?

BTW, I did try the the new "ATmega328 on a breadboard (8 MHz internal clock)" (but only once), and I got errors while loading that bootloader. However, I should try it again to be sure.

I manage to do this using the same bootloader but I found that the fuse settings is not correct. It can only upload the sketch once. I changed the fuse setting but I have to dig back to remember which bit. But I used a custom made board.

Well, tonight I confirmed that I can not burn the "ATmega328 on a breadboard (8 MHz internal clock)" bootloader. (Lilypad, 8MHz Pro Mini, & 16MHz bootloader all burn fine.)

I also tried disconnecting the crystal - no joy.

Coding Badly, I hesitate to begin the work to calibrate at this time. At this point in my project I am having fun - building hardware and writing the application. Bootloaders, fuses, long command lines, and the like, are a black art for me. This is evidenced by the dusty parallel programmer I use!

I also sense it's some kind of stupid error, and since Atmel ships that chip with the internal osc set, it seems strange it could be so far out that it won't take a program. Finally, the fact that I can not burn the bootloader that the powers have given us, indicates that I have some kind of problem. So for now, I'll spend most of my time on the fun stuff and run at 16MHz on 3.3V.

48x... If I understand, the "ATmega328 on a breadboard (8 MHz internal clock)" bootloader does burn for you, even though the fuses aren't correct. If so, I have some kind of issue. BTW, I like your board, and board I'm making has some similarities to it. It has a MAX1515 LiPo charger and a MAX1515 buck/boost reg (only needs 3 external caps). I'll post more on this soon.

On the bootloader, one thing I might try, would be to use the Arduino ISP. This is such a bizarre problem though. ::slight_smile:

Ahhh ok. I'll have to look into that for my next project I'm starting in a month. Thank you!