Atmega1280 low frequency crystal capacitance

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I connected a 32768 Hz crystal to the Atmega1280 without any external capacitors, and it oscillated at a freq about 200khz. I assumed that there were alrready 12.5pF caps internal to the chip, was I wrong?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, there are a lot of far-reaching phrases in your post. The general answer is "it depends".

Quote:

I connected a 32768 Hz crystal to the Atmega1280 without any external capacitors,

Connected to which pins? XTAL1/2? TOSC1/2? Other pins?
Quote:

and it oscillated at a freq about 200khz.

How are the pins configured? Are there any subsystems driving them?

Quote:

I assumed that there were alrready 12.5pF caps internal to the chip, was I wrong?

Well, I don't know. Why did you assume that? If you search the datasheet for 12.5, do you get any hits? I didn't.

There are many, many types of 32k crystals. On some generations of AVRs, the "right" crystal may need caps on one model and not on another.

If you look at some of the recent migration app notes to "P" chips, it spends some time talking about 32k crystals and the importance of ESR.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As long as we're talking about 'asynchronuous clock operation of timer2' (are we?) the datasheet seems to introduce some ambiguity here:

Quote:
10.11 Timer/Counter Oscillator
The device can operate its Timer/Counter2 from an external 32.768 kHz watch crystal or a external
clock source. See Figure 10-2 on page 42 for crystal connection.
Applying an external clock source to TOSC1 requires EXCLK in the ASSR Register written to
logic one. See “Asynchronous Operation of Timer/Counter2” on page 185 for further description
on selecting external clock as input instead of a 32 kHz crystal.
Even though fig. 10-2 - ext. caps needed - refers to XTAL1/2 while timer2 in asynchronuous mode is clocked from a crystal connected to TOSC1/2, I'm *assuming* that due to said figure there are no internal caps provided for the watch crystal on TOSCx.

Why not give it a try?

Andreas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Connected to TOSC1/2.

I found this in the Atmega128 datasheet:

For AVR microcontrollers with Timer/Counter Oscillator pins (TOSC1 and TOSC2), the crystal is
connected directly between the pins. No external capacitors are needed. The Oscillator is optimized
for use with a 32.768 kHz watch crystal. Applying an external clock source to TOSC1 is
not recommended.

I assumed it to be the same for Atmega1280 but I could not find a similar statement in the 1280 datasheet, after I designed the circuit. Guess I will have some mod wires...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Guess I will have some mod wires...

So, it works with caps? What is the ESR of your crystal? Did you try a low-ESR model? What about a 6pF vs. 12pF model? The same results? But you >>do<< get the 32kHz when you add caps? Or are you just assuming? We still haven't seen a code fragment with ASSR in it.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The crystal is a cm415.

Pads are already for this component.

ASSR = (1 << AS2);
TCCR2A = (1 << WGM21);
TCNT2 = 0;
OCR2A = 255;
TIMSK2 = (1 << OCIE2A);
TCCR2B = (1 << CS22) | (1 << CS21) | (1 << CS20);