mega328PB Testing Status

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

I recently received some mega328PB TQFP samples and populated a slightly modified mega328P test board.  The two chips are nearly pin-compatible, the differences are are shown below.

    pin  mega328P   mega328PB
    ---  --------   ---------
     3     Gnd      PE0
     6     Vcc      PE1
    19     ADC6     PE2/ADC6
    22     ADC7     PE3/ADC7

So far, I have not been able to get the mega328PB to work with a 16MHz crystal even though the same board with a mega328P and the same crystal and load capacitors works perfectly.  There also appears to be some odd behavior on the mega328PB with respect to the Clock Failure Detection circuitry and the clock prescaler.  I set the fuses for CLKOUT and full-swing oscillator with a 16MHz crystal.  Oddly, the measured frequency on the CLKOUT pin was the same (1MHz) irrespective of the states of the CFD and Divide-by-8 fuses.  Furthermore, the result was the same if I removed the crystal entirely.  When put in an 8MHz crystal, it behaved closer to what I expected except that the CFD fuse doesn't seem to do anything - it happily operates without a crystal (at 1MHz) irrespective of CFD.

 

I opened an issue with Atmel on the subject but I haven't heard back yet.

 

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

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

Hmmm--no errata in the rev. B datasheet.  Curiously, the '328PB datasheet is broken out from the other PBs in the family.

 

I put '168PB into one of our Mega88 apps without problems, including using a crystal (3.6864MHz).

 

 

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 datasheet has this to say:

Quote:
- In case of failure, the system clock will fallback to calibrated RC oscillator output
- 1MHz fallback clock
Quote:
- The fallback clock will be 1MHz. The figure shows system clock generation with CFD mechanism.
- User can change the clock by changing the prescaler after clock switching.
This suggests that the state of the CKDIV8 fuse will have no effect on the behaviour of the clock failure detection response.

 

I can find no reference in the datasheet to the CFD fuse.  The fuse section makes no mention of it.  The closest I can find is in the Sectionn 14:

Quote:
Fuse enabled CFD and is Active high (Fuse FEB bit 4)
This suggests that CFD is on bit 4 of the extended fuse byte.  Is this the bit you are programming/unprogramming?

 

What's more:

Quote:
The Clock Failure Detection mechanism for the device is enabled by an active high fuse
This suggests that a '1' fuse bit will enable this feature.  Without proper documentation it is difficult to know whether or not CFD has a factory-fresh value of '1' or '0', but my guess would be '1'.  >>If<< indeed the fuse bit is on bit 4 of the extended fuse byte, and >>if<< that is >>not<< the fuse bit you are fiddling with, then would this explain your observed behaviour?

 

Of course, none of this would explain why the 16 MHz crystal doesn't sing to begin with...

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Tue. Oct 13, 2015 - 05:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The '88PB datasheet has no mention of CFD.  The '328PB has a whole chapter. ;)

 

I don't have any of the beasties, but perhaps dkinzer could try the opposite setting of the CFD fuse and see what happens?  (I can smell a "bricked" AVR if the crystal is indeed failing, eh?)  Never mind--re-reading, that was already done:

irrespective of the states of the CFD and Divide-by-8 fuses. 

 

There is also the mention of the notification flag/ISR. See if the XFDIF flag is set?

 

Try Low Power instead of Full Swing?

 

 

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

joeymorin wrote:
Quote:

- In case of failure, the system clock will fallback to calibrated RC oscillator output 1MHz fallback clock

 

Thanks. I overlooked that.  It does corroborate what I'm seeing.

 

joeymorin wrote:
Fuse enabled CFD and is Active high (Fuse FEB bit 4)
When using Studio 7 (build 582) the CFD fuse checkbox changes bit 3 of the extended fuse byte (checked ==> 0, unchecked ==> 1).  I also tried bits 4-7 and none had any effect with regard to the 1MHz fallback clock.  Talking about fuse bit states is typically confusing and using "active high" doesn't help.  I think that "unprogrammed" and "programmed" (meaning one and zero, respectively) are the least likely to cause confusion given the way that the fuses work.  The mega328PB came with extended fuse bits 3-7 unprogrammed.

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

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

theusch wrote:
Try Low Power instead of Full Swing?
I tried that.  The 16MHz crystal wouldn't oscillate at that setting either and, even more suprising, the backup clock doesn't save the day in that configuration even though the datasheet says that the CFD "works only if the Low power crystal oscillator, External clocks, and Full swing crystal oscillator is used".  I was able to recover by injecting an 8MHz signal from CLKOUT of another board as is my usual practice in such cases.  However, on another iteration I made the mistake of powering down the mega328PB while the CLKOUT of the other board was connected to  XTAL1 and that apparently fried the oscillator input.  It is well and truly bricked now - injecting the 8MHz signal no longer allows the fuses to be read or written.

 

I've never had this (burnout) happen before during my many clock fuse adventures over the years.  It is possible that I've never powered down the target device like this before but I'm skeptical that such is the case.

 

Update: I just tried an experiment on a mega644PA.  It survived, apparently unharmed, after being powered down with a 5V clock signal applied to XTAL1.

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

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

Right but the phrasing suggests that the CFD fuse is active when high i.e. when 1 i.e. when unprogrammed. This would make it behave differently than every other fuse.
The datasheet simply isn't clear. Atmel need to be given feedback. I expect you have included that in your issue report...?

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

he two chips are nearly pin-compatible, the differences are are shown below.

WOW!! No problem if one has made the correct PCB for the M328. For people cutting corners (why connect all supply pins? etc. ) it may cause some "issues".

 

So we gain 2 pins PE0 and PE1, maybe they were there all the time but buggy silicon so they told the users to connect them to supply pins.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:
So we gain 2 pins PE0 and PE1 [...].
PE2 and PE3 as well.  Those pins are analog inputs only on the mega328P as well as on all forms of the mega168, mega88 and mega48 (32-pin packages only).

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

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

Those pins are analog inputs only on the mega328P as well as on all forms of the mega168, mega88 and mega48 ...

The Mega48/88/168PB family ("'88PB") also has PE0-PE3.

 

The '328PB is an interesting offshoot from the family.  Re-organized datasheet.  Additional features:  CFD as being discussed.  A second TWI.  OCM Output Compare Modulator.  PTC Peripheral Touch Controller. "Custom Logic" (on AC?).  Second USART.  Second SPI.  Two more 16-bit timers.

 

Much of the nomenclature for peripheral bits is different, in reading the datasheet.  That rewrite/reorganization is interesting, given the mature state of the AVR8.

 

'328PB does not show the 8-byte Device Signature of '88PB.  Oh, wait--it is described in the ADC chapter, but didn't make it to the Register Summary.  No description of ADMUX bits in the ADC chapter. ??? 

 

An interesting beastie.  I wonder how much it will cost.

 

 

 

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. Oct 14, 2015 - 01:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
The Mega48/88/168PB family ("'88PB") also has PE0-PE3.
You are correct.  It is interesting to to note that on the mega48PB, mega88PB and mega168PB the Port E pins do not have pin change interrupt capability.

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

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

It is interesting to to note that on the mega48PB, mega88PB and mega168PB the Port E pins do not have pin change interrupt capability.

Do they on the '328PB? ;) Maybe.  While listed in Table 6-1 PORT Function Multiplexing   PCIFR shows no PCIF3, nor is there a description/mention of PCMSK3 anywhere.

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

An interesting beastie.  I wonder how much it will cost.

 

As these have yet to bee seen in the wild, information is sketchy.  FindChips and Octopart finds no stack anywhere. Avnet Express is the only distributor showing a MOQ 1 pricing:  $2.37 qty. 1; $1.39 qty. 100.  Compare to Avnet Express pricing for the '168PB:  $2.10 qty. 1; $1.19 qty. 100.  So in moderate quantities we'd pay about $0.20 each for the '328 memory sizes and the toyz listed above.  (lol--if those extra features really work)

 

Let's peek at the prices from the same distributor for '168A:  $2.91/$1.78.  '168PA:  $3.15/$1.95.  '328P:  $3.57/$2.24.  So the "premium" is about twice that of the PB, if that pattern is followed for real.

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

theusch wrote:
PCIFR shows no PCIF3, nor is there a description/mention of PCMSK3 anywhere.
I can't yet confirm that they work but they are present in iom328pb.h supplied with the support pack on Studio 7.

#define PCIFR   _SFR_IO8(0x1B)
#define PCIF0   0
#define PCIF1   1
#define PCIF2   2
#define PCIF3   3
[...]
#define PCICR   _SFR_MEM8(0x68)
#define PCIE0   0
#define PCIE1   1
#define PCIE2   2
#define PCIE3   3
[...]
#define PCMSK3  _SFR_MEM8(0x73)
#define PCINT24 0
#define PCINT25 1
#define PCINT26 2
#define PCINT27 3
[...]
/* Pin Change Interrupt Request 3 */
#define PCINT3_vect            _VECTOR(27)
#define PCINT3_vect_num        27

Usually, I would attribute slightly more credibility to the datasheet than to the include file but, given the abysmal state of the mega328PB datasheet, in this case I trust the include file more.

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

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

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

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

dkinzer wrote:
<paste>

 I don't know if you've seen my thread on mega328PB testing but I'm having difficulty getting the oscillator to run with faster crystals.  The devices that I'm using are engineering samples (marked "ES", date code 1526) so the production devices may not have the same issue.  The full-swing oscillator works fine with 8MHz, 10MHz, and 12MHz crystals but not with 14.7456MHZ and 16MHz.

Interesting failure - I've sometimes found skewing the CL's, and generally less CL too,  helps when pushing Crystal Oscillators, and I've also used a fast diode (1N4148  or BAW62) to a Multimeter to each of + and GND to measure the Peak swings. Loads things much less then a scope probe does.

 

You should choose the smallest CL Crystal you can find.

 

As a general rule, Smaller crystals tend to have higher series R and are harder to Osc than larger crystals.

 

 

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

I received this from an Atmel IC designer via an Atmel tech support rep:

Quote:
The fullswing Osc in Mega328PB has issues working at frequencies > 4 MHz. The low power crystal Osc can work upto 16MHz in RevB of Mega328PB.

I've had success with the full-swing oscillator at 8MHz, 10MHz and 12MHz but not at 14.7456MHz and 16MHz.  However, the 8MHz crystal won't oscillate using the low power oscillator mode CKSEL[3:1] = 7 which is documented to be for frequencies of 8MHz and above.  Configuring the lower power oscillator for the 3MHz-8MHz range (CKSEL[3:1] = 6) does work at both 4MHz and 8MHz.

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

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

dkinzer wrote:

I received this from an Atmel IC designer via an Atmel tech support rep:

Quote:
The fullswing Osc in Mega328PB has issues working at frequencies > 4 MHz. The low power crystal Osc can work upto 16MHz in RevB of Mega328PB.

I've had success with the full-swing oscillator at 8MHz, 10MHz and 12MHz but not at 14.7456MHz and 16MHz.  However, the 8MHz crystal won't oscillate using the low power oscillator mode CKSEL[3:1] = 7 which is documented to be for frequencies of 8MHz and above.  Configuring the lower power oscillator for the 3MHz-8MHz range (CKSEL[3:1] = 6) does work at both 4MHz and 8MHz.

 

Hmm, that is a 20MHz part, so it sounds like it can't actually use a crystal to get to 20MHz ? - something of an oops.

I guess there is always an external oscillator...

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

Quote:

The fullswing Osc in Mega328PB has issues working at frequencies > 4 MHz. The low power crystal Osc can work upto 16MHz in RevB of Mega328PB.

 

What if you want to use a crystal for 20MHz operation?

 

Does your 14.7456 MHz crystal look like the same type as your 16 MHz crystal?

Maybe it's a series resonant type?

 

 

Last Edited: Mon. Oct 26, 2015 - 08:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ront1234 wrote:
Does your 14.7456 MHz crystal look like the same type as your 16 MHz crystal?

All of the crystals that I've been using are the same type and have the same specifications except for the resonant frequency.  They are all specified as 20pF load.  I've used this same type of crystal successfully on many different xmega, mega and tiny models with both 22pF and 27pF load capacitors at 7.37MHz, 14.7456MHz and 16MHz.

 

The Atmel engineer opined that the 27pF load capacitors were "out of range" for the mega328PB, insisting that the maximum load capacitor that one could use successfully is 22pF.  The crystal manufacturers indicate that the proper load capacitors should have a value of twice the crystal load specification minus the stray capacitance.  If the stray capacitance in a particular layout were as much as 10pF, the proper load capacitors for a 20pF crystal would be 30pF, well above the limit suggested.  Most of the crystals that I've looked at are in the 15-20pF load range.

 

It might be true that the range of load capacitors is more limited in the "low power" oscillator mode as compared to the "full swing mode" but the datasheet doesn't make that distinction, not even the more "mature" datasheets like those for the mega2560, mega1284P, etc.  The "recommended range" for load capacitors in most AVR datasheets is 12-22pF.

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

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

There is a trend to lower CL Crystals, and I see you can get  10pF, 9pF, 8pF, 7pF load specs for 16MHz , 20MHz

Smaller Crystals tend to have higher Rs, which further complicates MCU oscillator margins.

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

Hi all,

 

I got two ATmega328PB from Digikey (date code 1550), and both of them seem to be unable to work with 16MHz crystals (internal OSC works fine, also 8/12MHz crystal). Is that a "feature" of these chips? I wish I knew this before I chose them for a client's project! angry

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

igendel wrote:
Is that a "feature" of these chips? I wish I knew this before I chose them for a client's project!
If you need higher frequencies on these chips that no longer have the full swing oscillator, you'll have to add an external oscillator.  This will no doubt increase your parts cost but it will allow you to run the mega328PB at 16MHz (possibly up to 20MHz).

 

This discussion has been going on for more than four months now and the current datasheet indicates by omission that there is no full swing oscillator.  From what I've been able to determine the full swing oscillator is still present - it just doesn't work over 12MHz or so.  It would not surprise me, however, to discover that it has been eliminated on a future silicon revision.

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

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

dkinzer wrote:

If you need higher frequencies on these chips that no longer have the full swing oscillator, you'll have to add an external oscillator.  This will no doubt increase your parts cost but it will allow you to run the mega328PB at 16MHz (possibly up to 20MHz).

 

I'm not sure I understand what this means... I'm using a simple crystal oscillator (through-hole), SUT_CKSEL set to EXTXOSC_8MHZ_XX_16KCK_14CK_65MS, tried different cap values to make sure they're not the cause - where in the datasheet does it say (or imply) this setup won't work?

 

[Edit: Of course, the circuit get 5V]

Last Edited: Sun. Mar 20, 2016 - 04:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

igendel wrote:
I'm using a simple crystal oscillator (through-hole), SUT_CKSEL set to EXTXOSC_8MHZ_XX_16KCK_14CK_65MS, tried different cap values [...]
A crystal and two capacitors does not constitute an oscillator.  In order to get a crystal to oscillate you need a non-inverting amplifier.  Traditionally, AVR mega devices have had two oscillator circuits - low power and full swing - that produced the desired clock frequency in conjunction with an external crystal with the proper load capacitors.  The new mega PB devices have eliminated the full swing oscillator circuit at least with respect to the documentation.

 

If you set the fuses for an external oscillator then you need a standalone circuit outside of the AVR that produces the desired clock frequency and that clock signal is fed into the XTAL1 pin.

 

You can buy standalone crystal oscillators (see, for example, Digi-Key part number CTX270LVTR-ND) but you can also make one using two inverters, a crystal and the load capacitors (sometimes a high value resistor is also needed).  Either of those would constitute an external oscillator.

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

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

dkinzer wrote:

If you set the fuses for an external oscillator then you need a standalone circuit outside of the AVR that produces the desired clock frequency and that clock signal is fed into the XTAL1 pin.

 

Thanks for the explanation - it's clearer now. However, this means the 328PB cannot replace a 328P in existing circuits with 16MHz crystals, and - again - the datasheet still says it can go to 16MHz on low-power (page 45, in "Atmel-42397C-8-bit AVR-ATmega328PB_Datasheet_Complete-10/2015"). That's plain cheating, isn't it?

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

Does it have a clockout pin? Just run that through a buffer and pump it back into the xtal1 pin?

Imagecraft compiler user

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

bobgardner wrote:

Does it have a clockout pin? Just run that through a buffer and pump it back into the xtal1 pin?

 

It has a clock out, but at this point I'm not looking for workarounds - I want to verify first that these issues are not just my misunderstanding, but a real problem with the chip.

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

An AVR with similar power down and power save current consumption as a mega328PB is an RF AVR but an RF AVR is a 1.8V core with 3V I/O (somewhat apples and oranges).

The 16MHz RF AVR crystal from the BOM for the mega256RFR2 Xplained Pro :

# Designator Quantity Value Manufacturer MPN Description
56 XC301 1 16.0MHz GEYER ELECTRONIC 12.88785 3.2X2.5mm; 10/15/5ppm; 9pF; 80Ohm (de33221)
9 C305, C307 2 12pF Kyocera-elco CM05CG120J50AH Ceramic capacitor, SMD 0402, NP0, 50V, +/-5% (de19819)

C305 and C307 are the crystal oscillator load capacitors; schematic has "Strap for testing crystal safety factor" (for a current probe to evaluate that oscillator).

http://www.geyer-electronic.com/index.php

http://www.geyer-electronic.com/Quartz-Crystals-MHz-SMD.605+B6Jkw9MQ__.0.html

http://www.geyer-electronic.com/uploads/tx_userartikelfrequenz/GEYER-KX-7_16.pdf

 

Might be worth a proof-of-concept.

The mega328PB Xplained Mini does not have pads for a 16MHz crystal other than the 16MHz crystal for the mega32U4 (the mEDBG MCU).

Could deadbug a crystal circuit to the mega328PB though likely easier to spin a PCB.


http://www.atmel.com/tools/ATMEGA256RFR2-XSTK.aspx?tab=documents

 

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

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

bobgardner wrote:

Does it have a clockout pin? Just run that through a buffer and pump it back into the xtal1 pin?

Funny.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

Does the mega328PB have the same low power crystal oscillator as a mega324PB?

 

Atmel

ATmega324PB Xplained Pro
USER GUIDE

http://www.atmel.com/tools/ATMEGA324PB-XPRO.aspx?tab=documents

4.2.1. Crystals
The ATmega324PB Xplained Pro kit contains one mounted 16MHz crystal and a footprint for a 32.768kHz crystal that can be used as clock sources for the ATmega324PB.

The crystals have cut-straps next to them that can be used to measure the oscillator safety factor.

This is done by cutting the strap and adding a resistor across the strap.

Information about oscillator allowance and safety factor can be found in application note AVR4100, information about clock calibration and compensation can be found in application note AT03155.

From its BOM :

Fitted Designator Quantity Value Manufacturer MPN

Description

Fitted XC200 1 16.0MHz Epson Toyocom TSX-3225 16.0000MF09Z-AC3 16MHz uXtal, 3.2 x 2.5 mm SMD, CL=9pF, 15PPM, ESR=80ohm(Max.
Fitted C205, C206 2 1.8p     Ceramic capacitor, SMD 0402, NP0, 50V, +/-0.25pF

 

9pF and 1.8pF

It's a low power oscillator and may need tuning (capacitors and maybe a resistor) to match the crystal to your PCB.

 

From its schematic note for that oscillator :

Crystal datasheet (16MHz):
Load capacitance CL = 9pF
ESR 60 Ohm Max.
Frequency tolerance +/- 10 ppm

 

Ce = 2(CL - Ci - Cs) = 2 (9pF - 8.1pF) = 1.8pF
where:
Ce - is the external capacitance needed
CL - is the load capacitance specified by the
crystal vendor
Ci - is the pin capacitance
Cs - is the total stray capacitance, assumed to be
<1pF and can be ignored
Ce of 1.8pF was selected after measururing
frequency, this gives an approximate
combination of pin capacitance and stray
capacitance of 8.1pF

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

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

Abracon Logo

Understanding the basics of the Pierce oscillator

by Syed Raza

Director of Engineering

Abracon

http://abracon.com/Support/AppsManuals/Resonators/Pierce%20Oscillator%20Configuration.pdf

The designer’s challenge is to optimize performance with the quartz crystal

...

The key limitation is the proper matching of the quartz crystal with the on-board Pierce oscillator.

...

... the overall long-term performance of the oscillator loop is influenced by the following factors:

...

This boundary condition, commonly referred to as the safety factor (SF), is an important parameter to ensure that the product design has sufficient margin to accommodate part-to-part and lot-to-lot variations; as well as, eliminating product performance uncertainty in production volume.

...

Further, to properly determine the oscillator loop dynamics, the most accurate determination is made by breaking the oscillator loop and conducting key measurements using specialized equipment such as a current probe.

...

... the oscillator-loop drive level must also be properly quantified to ensure acceptable product performance over temperature and time.

...

... it is possible that, over temperature or time, the oscillator circuit might start to resonate permanently or intermittently — at a spurious or overtone mode of the quartz crystal.

...

The Pierce Analyzer System

To overcome these challenges and provide an accurate assessment of the oscillator loop dynamics, Abracon’s Advanced Engineering Team has developed a proprietary Pierce Analyzer System (PAS), designed to analyze both the standalone crystal, as well as the performance of that particular crystal in the final circuit.

Key PAS features

...

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

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

igendel wrote:

...this means the 328PB cannot replace a 328P in existing circuits with 16MHz crystals...That's plain cheating, isn't it?

 

Atmel claims that it was to save money. (good idea?: add something, take away something)

There are some new PB features but now are they going to sell as many PB units as the original devices?

 

 

 

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

igendel wrote:

It has a clock out, but at this point I'm not looking for workarounds - I want to verify first that these issues are not just my misunderstanding, but a real problem with the chip.

 

I think it is certainly a problem with the Chip.

 

A  Classic Crystal Oscillator, is an inverter and caps and Xtal and Bias resistor.

It needs a net gain of over unity, at the Xtal frequency, in order to amplify noise into an eventual sine wave.

 

That means you can help the chip along, with lower values ( as Atmel seem to be doing in spades here  !!)

Notice the lowest Xtal CAP load spec of 9pF and PCB values of a mere 1.8pF (ie most of the Xtal load is the Pin C & PCB C)

Also a lower ESR helps too.

- Basically, I'd find the lowest CL, Lowest ESR Xtal you can find, (within budget) and test with that.

 

From above:

Fitted XC200 1 16.0MHz Epson Toyocom TSX-3225 16.0000MF09Z-AC3 16MHz uXtal, 3.2 x 2.5 mm SMD, CL=9pF, 15PPM, ESR=80ohm(Max.
Fitted C205, C206 2 1.8p     Ceramic capacitor, SMD 0402, NP0, 50V, +/-0.25pF

 

 

Digikey show ~60 Thru-hole 16Mhz xtals

Lowest Stock item is 12pF  9B-16.000MAAE-B ESR 30 Ohms.  19c /1k

The 12pF is not super critical, that is for 16.000MHz,  if you use load values like Atmel did for a 9pF CL, your 16MHz will be slightly high.

Lower ESR means it will start better.

 

Install a few, and start with the very low Caps Atmel used, and check your 16MHz on a toggling pin.

 

Ones lower than 30 Ohms ESR, are all in larger cans - it is a general rule that the smaller a Crystal, the higher the ESR, so you may be lucky you did not choose a tiny SMD crystal here :)

 

 

Last Edited: Sun. Mar 20, 2016 - 10:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who-me wrote:

That means you can help the chip along, with lower values ( as Atmel seem to be doing in spades here  !!)

Notice the lowest Xtal CAP load spec of 9pF and PCB values of a mere 1.8pF (ie most of the Xtal load is the Pin C & PCB C)

Also a lower ESR helps too.

- Basically, I'd find the lowest CL, Lowest ESR Xtal you can find, (within budget) and test with that.

 

I see. In that case, the datasheet is plainly misleading (table 12-3: for low power crystal osc., 8-16MHz, range of capacitance = 12 to 22pF).  Even if I found a crystal/cap combination that works in the lab, I'd be afraid it may fail in the field on a hot day or whatever... what a disappointment.

 

Thanks for the useful replies everyone. It seems my project got screwed over by this issue, but at least I know where I stand.

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

The mega328PB datasheet Electrical Characteristics section does not contain crystal oscillator characteristics whereas XMEGA do but XMEGA are significantly older than mega328PB.

XMEGA A1U is complete for crystal oscillator characterization; XMEGA E5 is almost complete (missing oscillator impedance and crystal max ESR).

A third party XMEGA E5 board shows a "large" canned SMD 16MHz crystal with 22pF NPO load capacitors.

XMEGA E5 power-down current is slightly greater than mega328PB.

XMEGA is not a solution because you stated it's 5V power.


MattairTech LLC

MattairTech

Development Boards

MT-DB-X5 Atmel AVR XMEGA E 32-pin ATxmega32e5 development board

https://www.mattairtech.com/index.php/development-boards/mt-db-x5.html

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

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

Note that the full swing oscillator has also been "removed" from a large number of other ATmega chips.  Fortunately (?) some of those (like the 328P) have been operating with 16MHz crystals using the low-power oscillator setting without problems.  Hopefully they'll continue to do so.

 

Have you tried a ceramic resonator?

 

Still, this is disappointing :-(

 

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

westfw wrote:

Have you tried a ceramic resonator?

 

I've already designed the PCB with a footprint for a crystal.. even if it works, putting a ceramic resonator there would be an ugly bodge at best :-)

 

Luckily my project can make do with the internal 8MHz oscillator. I would like to hear though if the ceramic resonator works.

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

igendel wrote:
I've already designed the PCB with a footprint for a crystal..

You laid out a PCB without building a prototype first? Possible lesson to be learned here I think wink

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

clawson wrote:

You laid out a PCB without building a prototype first? Possible lesson to be learned here I think wink

 

Oh boy there are many lessons to be learned here...

 

Actually, the PCBs are being printed somewhere in China as we speak; these are only ~10 board for the prototype. The crystal in particular is a hard thing to get right on a breadboard/Prefboard because of parasitic capacity and such, so for too long I thought this issue was my fault. Who would have thought Atmel would suddenly break such a basic AVR feature?

 

Next time, definitely, I won't dare to trust MCU manufacturers or their datasheets... frown

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

westfw wrote:

Note that the full swing oscillator has also been "removed" from a large number of other ATmega chips.  Fortunately (?) some of those (like the 328P) have been operating with 16MHz crystals using the low-power oscillator setting without problems.  Hopefully they'll continue to do so.

 

Have you tried a ceramic resonator?

 

Still, this is disappointing :-(

 

Sorry, are you saying that a recent revision of the 328P (no 'B') has lost the full swing?

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

"It ain't worth a thing if it has lost full swing"

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Mon. Mar 21, 2016 - 08:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

are you saying that a recent revision of the 328P (no 'B') has lost the full swing?

Yep.  Many other parts as well.  "die change" according to the PCN.  Maybe Microchip will fix this. :-)

Atmel ATmega Revision Change Notification:
This email is to notify you of a recent Atmel revision change. Our records show you have purchased at least one affected part and this change may affect the application when receiving future orders of ATmega parts. 

One important change is the removal of the Full Swing Crystal as a clock source option. If your application is currently using this, it will need to be converted to one of the other supported clock sources listed on page 28 of the datasheet.
Changes
New die revision changes: 
• Full swing crystal oscillator not supported 
• Power Save mode current consumption increased
(ATmega48P, ATmega88P, ATmega168P) 
• Parallel programming timing modified 
• Write Wait Delay for NVM is increased 
• Device ID 

Please see the attached Atmel PCN WC154601 for the complete list of changes and affected parts.

 

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

http://forum.arduino.cc/index.ph...

 

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

westfw wrote:

are you saying that a recent revision of the 328P (no 'B') has lost the full swing?

Yep.  Many other parts as well.  "die change" according to the PCN.  Maybe Microchip will fix this. :-)

Atmel ATmega Revision Change Notification:
This email is to notify you of a recent Atmel revision change. Our records show you have purchased at least one affected part and this change may affect the application when receiving future orders of ATmega parts. 

One important change is the removal of the Full Swing Crystal as a clock source option. If your application is currently using this, it will need to be converted to one of the other supported clock sources listed on page 28 of the datasheet.
Changes
New die revision changes: 
• Full swing crystal oscillator not supported 
• Power Save mode current consumption increased
(ATmega48P, ATmega88P, ATmega168P) 
• Parallel programming timing modified 
• Write Wait Delay for NVM is increased 
• Device ID 

Please see the attached Atmel PCN WC154601 for the complete list of changes and affected parts.

 

That's quite a few things that have gone backwards, with a supposed 'die revision' - who signed off on that ?

Meanwhile, other vendor's parts have been improving, (eg more MHz, not less)  so Atmel can expect some lost sales as a result...

 

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

igendel wrote:

 I would like to hear though if the ceramic resonator works.

Easy enough to try.

Working against resonators, is they tend to have higher CL specs, and many include those CL, meaning you cannot remove them.

Working for a resonator, is their lower Q may mean wider noise pass, and easier startup.

 

You could maybe try this one ?

PRQC16.00SR1010V00L

 

or lowest CL @ 5pF inbuilt

CSTCE16M0V51-R0

 

or if you like thru hole, maybe this one

CSTLS16M0X51-A0

 

 

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

That's quite disconcerting.  And disappointing.  The BOM for most of my projects just grew by an external oscillator.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

FWIW, on some ATmega8 circuits, I had to switch to the full swing oscillator to get my ceramic resonator to work, although crystal-based arduinos with the same chip apparently worked with the low-power option.

Sigh.

Oscillators are relatively expensive.  And/or high power.

 

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

Who-me wrote:

Easy enough to try.

 

Not when every order from a respectable vendor costs $40 in shipping wink

Thanks for the model numbers though, I put them in my "to do at some time" list.

 

Edit:

 

westfw wrote:

FWIW, on some ATmega8 circuits, I had to switch to the full swing oscillator to get my ceramic resonator to work

 

Ouch.

Last Edited: Tue. Mar 22, 2016 - 10:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

FWIW, on some ATmega8 circuits, I had to switch to the full swing oscillator to get my ceramic resonator to work, although crystal-based arduinos with the same chip apparently worked with the low-power option.

Sigh.

Oscillators are relatively expensive.  And/or high power.

 

 

Sounds like standard resonators are no magic bullet, but I'd expect the newer, very low CL resonators, I linked above to be better.