Confusion about ATmega328PB system clock options

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

After reading the datasheet (rev. C) and reading some (all?) discussions here about running the ATmega328PB from a crystal oscillator i'm still somewhat confused ...

 

Here is what is think to understand so far:

  • it does not have the full swing oscillator option
  • low power oscillator option can only be used up to 16Mhz
  • people where reporting problems running them from 16Mhz oscillators but that was for early engineering samples (?)

 

What is still not clear to me is this:

  • do current production chips have problems running from an 16Mhz crystal oscillator?
     
  • how critical is the choice of the oscillator and the bypassing caps?
     
  • are the capacity values (12-22pF) in the datasheet valid for production chips?
     
  • what about rel. long traces on a prototype, like having the AVR on a throughhole adapter and the oscillator also an a mini board (for fast exchange), so we are talking about ~20 mm traces?
    i use this somewhat heavy-handed setup in prototype boards for years now and have never had problems running various ATmegas with it ... devil
     
  • what about running it from an external clock? is up to 20MHz within spec?
    according to "12.7. External Clock" no, 16Mhz top!?
    according to various other places in the datasheet, especially "34.4.3. External Clock Drive" and "34.3. Speed Grades" probably yes ...

 

 

If the ATmega328PB would not be so tempting for my project due to the many timers it has i think i would not even bother ...

 

Thanks,

Bertolt

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

First the last.

There are no problems with 20MHz with an external clk.

 

And about all the timers don't use them if you don't need them :)

The PB version  is cheaper and have more IO's.

 

And I hope for atmel than it run 16MHz with a crystal !

 

And then the stupid question do you need to run faster than 8 MHz ? 

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

sparrow2 wrote:
And I hope for atmel than it run 16MHz with a crystal !
I haven't had any luck running faster than 12MHz using the low power oscillator on both the samples and the production chips.  This could be an issue with my particular layout, I suppose, but it is interesting to note that a mega328P on the same board works fine. I would have to reconfirm this but I believe that the early mega328PB production units that I have still had the full swing oscillator and it worked fine as high as 16MHz.  I didn't try faster crystals.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

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

I have some 328PB's they are from week 8 (marked 1608)  I don't know which version those are, and I use them in a cheap board so so far I have only used 8 MHz internal.(and the board use xtal pins as IO's so no easy check). 

 

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

Hmmm ..., kinda sad they did this to "our" AVRs ...

They used to be really simple, robust and forgiving with crystal oscillators on fill swing, oh well!

 

I think i'm going for an external 18.432MHz clk.

Don't feel like dicking around with a 16MHz crystal and hoping to make it work!

 

Thanks a lot,

Bertolt

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

Hi also getting trouble with Atmega328PB, causing problem with external 16Mhz crystal osc,  on same desiign Atmega328p is working fine, but this got reset and abnormal behavior every now and then,
unable to find the real cause, although i m experimenting
 

If you looking for piece then prepare for war.

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

Shaheers wrote:
Hi also getting trouble with Atmega328PB, causing problem with external 16Mhz crystal osc,  on same desiign Atmega328p is working fine,

Note: Atmel removed the full swing xtal oscillator from the PB version, leaving only the low power xtal osc, so may not work as well in noisy environments, it may be better to use an external oscillator rather then an external xtal in this environment.

Search for the MC app notes and discussions here about this change.

https://www.microchip.com/wwwApp...

 

Jim

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Excessive capacitive loading on the low power crystal oscillator will reduce its safety factor such that the oscillator may fail to start; crystal ESR is also a factor.

CFD is new to PB megaAVR so can fail-over to the internal 8MHz RC oscillator then the application can detect the XTAL1/XTAL2 fault.

Selected MHz resonators are effective for PB megaAVR.

 

ATmega328PB (datasheet)

[page 50]

...

The total load (Ce+Ci+Cs) on XTAL pins must not exceed 22 pF.

...

via ATmega328PB - 8-bit AVR Microcontrollers

Pololu - A-Star 328PB Micro - 5V, 20MHz

 

edit :

Fan control prototype, unsure of some parts of the circuit. | AVR Freaks

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Oct 14, 2019 - 03:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

Note: Atmel removed the full swing xtal oscillator from the PB version, leaving only the low power xtal osc, so may not work as well in noisy environments, it may be better to use an ex

Search for the MC app notes and discussions here about this change.

https://www.microchip.com/wwwApp...

Jim

Thanks for pointing out, so should i use something like active crystal osc? ...

gchapman wrote:

Excessive capacitive loading on the low power crystal oscillator will reduce its safety factor such that the oscillator may fail to start; crystal ESR is also a factor.

CFD is new to PB megaAVR so can fail-over to the internal 8MHz RC oscillator then the application can detect the XTAL1/XTAL2 fault.

Selected MHz resonators are effective for PB megaAVR.

 

ATmega328PB (datasheet)

[page 50]

...

The total load (Ce+Ci+Cs) on XTAL pins must not exceed 22 pF.

...

via ATmega328PB - 8-bit AVR Microcontrollers

Pololu - A-Star 328PB Micro - 5V, 20MHz

 

Im connecting 22pF capacitors to gnd with crystal, may i test it by removing it? but .. this may not capable of driving other clock inputs as mention below

Here is datasheet says on 11.3
Low-Power Crystal Oscillator
This Crystal Oscillator is a low-power oscillator, with reduced voltage swing on the XTAL2 output. It gives
the lowest power consumption, but is not capable of driving other clock inputs, and may be more
susceptible to noise in noisy environments.
The crystal should be connected as described in Clock Source Connections. When selecting crystals,
load capacitance must be taken into consideration. The capacitance (Ce+Ci) needed at each TOSC pin
can be calculated by using:
Ce + Ci = 2CL − Cs
where:
• Ce - is optional external capacitors. (= C1, C2 as shown in the schematics.)
• Ci - is the pin capacitance in the following table.
• CL - is the load capacitance specified by the crystal vendor.
• CS - is the total stray capacitance for one XTAL pin.
 

If you looking for piece then prepare for war.

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

Shaheers wrote:
Im connecting 22pF capacitors to gnd with crystal, may i test it by removing it?
Yes

Shaheers wrote:
but .. this may not capable of driving other clock inputs as mention below ...
Concur; the few or several pico-farads of a buffer's input will reduce XTAL safety factor.

In-lieu of, signal CLKO on pin 12.

ATmega328PB (datasheet)

[bottom of page 54]

11.8 Clock Output Buffer

via ATmega328PB - 8-bit AVR Microcontrollers

 

"Dare to be naïve." - Buckminster Fuller

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

Shaheers wrote:
Ce + Ci = 2CL − Cs
where:
• Ce - is optional external capacitors. (= C1, C2 as shown in the schematics.)
• Ci - is the pin capacitance in the following table.
• CL - is the load capacitance specified by the crystal vendor.
• CS - is the total stray capacitance for one XTAL pin.

 

You will need to review the DS for the xtal you are using and estimate CS above and pick Ce caps that are best for your application.

My experience with M328PB's with VCC = 5v, we selected 12-18pf caps for our xtal and they seemed to work ok for applications that run mostly at normal room temperatures.

For extreme temp applications (ie. very cold) we used an external TCO to drive the xtal2 pin, but YMMV!

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Regarding "The total load (Ce+Ci+Cs) on XTL pins must not exceed 22pF".

 

I am reasonably sure that the C1 and C2 capacitors are acting in series (not parral) to the oscillator. So that means they contribute Ce = C1*C2/(C1+C2) or since C1= C2 I can say Ce = 0.5*C1. The stray and pin capacitance do the same, which is why Ce+Ci+Cs = 2CL.

 

The datasheet says that crystals specifying a load capacitance higher than 6 pF require external capacitors, so I take that to mean a good layout can yield (Ci+Cs)*0.5 = CL = 6pF. Which means Ci+Cs are 12pF. Now, if I have a 27pF C1 and C2 and my stray and pin capacitance are almost as good (say 13pF), then (27pF +13pF)*0.5 =  20pF for my CL, which is what my crystal wants. I think that is the load capacitance seen by the XTAL pins, even though a 27pF was used.

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

Why more recent MCU aren't functional with the jelly bean HC/49 crystal (other than XMEGA : HC49, 22pF load capacitors)

Abracon-Application-Note-1025-18pF-Crystals-May-Not-Oscillate-with-Energy-Saving-MCUs.pdf (3 pages)

via Abracon | Resources | Application Notes (edit : crystal)

 

One resonator that may be PB megaAVR compatible (low ESR, very low shunt capacitance, low load capacitance)

ABM8GAIG.pdf (Abracon)

 


Jameco - current sale and clearance on most crystals, some resonators, and some oscillators.

Jameco Electronics - Electronic Components Distributor

Passive Components -> Frequency Control

 

edit2 :

Abracon | Pierce Analyzer System (PAS) - Advanced Board Characterization Service (PDF)

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Oct 14, 2019 - 07:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:
aren't functional

 

I do have a 324pb running with a 16MHz HC/49 crystal at 20pF load, but it is not well tested, so I need to keep a lookout for it failing to start. I wonder if it would be more likely to have the problem cold or hot.

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


via ATmega324PB_Xplained_Pro (schematic, PDF, page 3, C1) via ATmega324PB Xplained Pro

crystal : Epson Toyocom, TSX-3225 16.0000MF09Z-AC3, 16MHz uXtal, 3.2 x 2.5 mm SMD, CL=9pF, 15PPM, ESR=80ohm(Max.

https://octopart.com/tsx-3225+16.0000mf09z-ac3-epson-42855117

 

 

"Dare to be naïve." - Buckminster Fuller

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

By Jim's post, cold (gm is proportional to temperature)

edit : typo

 

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Oct 14, 2019 - 08:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can reduce the load to 16pF though not in a HC/49 (it's a can)

ab308.pdf (Abracon AB308)
http://dilp.netcomponents.com/cgi-bin/abracon.asp?partnumber1=AB308-20 (AB308 20MHz inventory)

http://dilp.netcomponents.com/cgi-bin/abracon.asp?partnumber1=AB308-16 (AB308 16MHz inventory)

 

Less load may be only by a SMD crystal.

A 10pF load capacitance HC49 though single source with a single distributor :

IQD Quartz Crystals - HC49/4H - 20.0MHz 10pF

 

edit : strikethru

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Oct 16, 2019 - 05:16 PM