ATmega128RFA1, RTC crystal won't start.

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

[EDIT: Old title "ATmega128RFA1 won't wake from deep-sleep using SymbolCounter."]

 

Ok, I'm totally confused.

I'm using ATmega128RFA1 as a microcontroller, sending it to deep-sleep and waking it with symbol counter interrupt (using an external 32.768kHz crystal/oscilator).

 

I have ~ 20 microcontrollers with the same code and all but two wake up after the configured time, now the question is why are there two that won't wake up?

I'm using the same components, two layout for PCBs (one microcontroller on each won't work), and can't see a difference between them.

 

I'm measuring the voltage on the crystal, and it's the same on all the microcontrollers (an oscillating signal of 32kHz, ~0.36V mean value)

EDIT: measured again and on the not-waking microcontroller I have no oscillating signal, I have just noise with mean value of ~0.36.

 

The crystal, 12.5pF, 35kOhm ESR, the capacitor are some 12pF ones.

 

So, ¿ideas?

 

I'll atach a picture with the layout of the microcontroller and crystal soon.

 

 

Last Edited: Wed. Jul 1, 2015 - 04:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Uploading the images.

Attachment(s): 

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

How do you know it is not waking up, as opposed to waking but getting all I/O blocked by some interrupt race?  Talking to the radio before it is ready can have strange effects; see if increasing the wake delay by 2x has any effect.

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

dak664 wrote:

How do you know it is not waking up, as opposed to waking but getting all I/O blocked by some interrupt race?  Talking to the radio before it is ready can have strange effects; see if increasing the wake delay by 2x has any effect.

 

Because I'm using the same code on several microcontrollers, and only two won't wake up.

And after waking up, the first thing that happens is sending some information through the serial port (which should be slow).

And none of my interrupts block (or at elast, shouldn't), they update a bit which is then checked on the main loop (which occurs after waking up).

 

 

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

The 'RFA1 is an "interesting" beast -- kind of like a regular AVR8 Mega, but I've seen threads with interesting differences.  And I'm not a user of that model.

 

But generally, when I hook a watch crystal to the TOSC pins of an AVR8 the design uses a watch crystal with ESR and such as outlined in some migration app notes and elsewhere.  No load caps.  So I'm speculating that those particular units didn't appreciate the added capacitance.  But you said you see it wiggle with the 'scope.

 

For example, the Mega88-family datasheet has the below discussion, if you haven't already seen it.  I guess I'm saying pop the caps, and/or use a smaller value, and see if the symptoms change.

 

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.

Last Edited: Wed. Jun 10, 2015 - 02:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:

The 'RFA1 is an "interesting" beast -- kind of like a regular AVR8 Mega, but I've seen threads with interesting differences.  And I'm not a user of that model.

 

But generally, when I hook a watch crystal to the TOSC pins of an AVR8 the design uses a watch crystal with ESR and such as outlined in some migration app notes and elsewhere.  No load caps.  So I'm speculating that those particular units didn't appreciate the added capacitance.  But you said you see it wiggle with the 'scope.

 

For example, the Mega88-family datasheet has the below discussion, if you haven't already seen it.  I guess I'm saying pop the caps, and/or use a smaller value, and see if the symptoms change.

 

you made me doubt myself so I measured the signals again and no, I see theres no oscillating signal on my crystal.

So I guess indeed my crystal isn't starting, so I'm having problems with my capacitors (I guess).

 

On the RFA1, the example circuit does have capacitors for the crystal.

And re-reading the datasheet:

 

According to the calculation of the capacitors, it should be:
Cmin = 2*(12.5 - 2 - 2.7) = 15.6pF

Cmax = 2*(12.5 - 0.6 - 2.1) = 19.6Pf

 

So the capacitance should be between 15.6 and 19.6pF, this should be ¿each capacitor?

 

This is the application circuit: 

 

I'll play with the caps, and see what happens.

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

Ok tried no caps, 12pf caps and 13.5caps, no oscillating signal on either case.

 

I don't have bigger caps :(

 

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

There can be substantial variation between boards when using high-impedance devices,  I suspect depending on subtle variations in the crud that has collected over time. For the Raven boards the radio oscillator startup time varied as much as a factor of two.  It might be instructive to measure the variation in wake times of the functioning boards by scanning the  XTAL_TRIM as shown in this thread:

 

https://www.avrfreaks.net/forum/r...

 

The question in the last post was never answered:

I scanned the XTAL_TRIM register from 0x0 to 0xF while looking at the wake time. Didn't see much difference between STK500 power or internal battery power. My reading of the datasheet is that the typical 880 us wake time is when
CL =0.5*(CX+CTRIM+CPAR)= 10 pF
The board CX caps are a nominal 12 pF each, the 880us intercept extrapolates to -12 or CTRIM=-3.6 pF, so all would make sense if the existing CPAR is 11.6 pF. Does that seem a reasonable value for parasitic capacitance?

Last Edited: Thu. Jun 11, 2015 - 06:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So I've tried with more caps with same result:

12pF, 13.5pF and 20pF and the crystal won't start.

 

Tried 12pF and 20pF on another board, and the crystal starts.

Rechecked the conections and they're correct (I do get a voltage on the crystal).

 

Replaced the board (same components on new board) and the crystal won't start.

Changed the crystal: the new crystal won't start (it came from another board where it did start).

 

So, is it the microcontroller?

But why?

...