ATMEGA328pb Frequency Instability issues-- Solved

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

I was having some issues that randomly it would seem to loose the 16mhz clock .

My "heartbeat" LED that would strobe about 4 times a second would randomly (sometimes when IRQ 0 would hit, or changed I/O's) would change to a rate of 1 flash every 2-3 seconds... 

Resting the MCU would not fix it ... I would have to remove power completely to restore the 16Mhz clock.

And I had a 16Mhz xtal on PB6 & PB7. with 22pf Caps to ground.  I also tried to change it to 10pF caps. still same thing ...

I am using the Adafruit 32 TQFP bearkout board. 

https://www.adafruit.com/product...

The ONLY fix I was able to come up with was using a actual 16Mhz TTL Clock input on PB6 and that fixed everything. 

It seems that the Xtal Amplifier is alittle weak on the 328pb... 

Dont know if it is with the breakout board... or if is a issue with the 328pb. 

 

SO ... if anyone is having issues with Frequency instability using atmega328pb on a Breakoutboard Try using something like this:

CTS-Frequency Controls CB3-3C-16M0000

https://www.digikey.com/product-...

 

Thought I would Share.

Michael

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

Though not as accurate as an oscillator, a resonator can be functional on a mega328PB.

Fan control prototype, unsure of some parts of the circuit.

by JoniS

https://www.avrfreaks.net/forum/fan-control-prototype-unsure-some-parts-circuit

...

https://www.avrfreaks.net/forum/fan-control-prototype-unsure-some-parts-circuit#comment-2088696

 

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

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

I've used an xtal in several328pb projects (not quite at 16MHz), but everything has been 100% rock solid (like 5-6 digits of freq accuracy  & about 7-8 of stability). 

 

This is both breadboarding, with a ratsnest of TQFP hand soldering wires everywhere & also production boards.

 

Make 100% sure you have selected the correct clock setting, the naming used by Atmel was somewhat poorly choosen.

 

Maybe the xtal you picked was designed to be driven by higher than normal levels.

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

ettill777 wrote:

I am using the Adafruit 32 TQFP bearkout board. 

 

breakout boards are less than ideal for things like crystals, the high pin-to-pin C, makes what was just ok, more marginal...

What Xtal did you use ?

 

ettill777 wrote:

My "heartbeat" LED that would strobe about 4 times a second would randomly (sometimes when IRQ 0 would hit, or changed I/O's) would change to a rate of 1 flash every 2-3 seconds... 

The ONLY fix I was able to come up with was using a actual 16Mhz TTL Clock input on PB6 and that fixed everything. 

It seems that the Xtal Amplifier is alittle weak on the 328pb... 

What frequency exactly did it run at ? eg - did it fire some missing clock detector and switch to internal RC ?

 

ettill777 wrote:

Resting the MCU would not fix it ... I would have to remove power completely to restore the 16Mhz clock.

RESET these days, seems more like a reset request.  I recall Alarm industry types, who insisted on power-removal watchdogs.

Sounds like that wwould be the right call in this case too....

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

The Pololu 20MHz mega328PB board has a resonator but with a warning :

Pololu Robotics and Electronics

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

https://www.pololu.com/product/3161

...

 

(approx mid-page)
Speed warning for 20 MHz version: The 20 MHz resonator frequency exceeds the maximum explicitly allowed in the ATmega328PB datasheet. In our basic testing, the 20 MHz resonator appears to function without problems, but for any critical applications you should confirm for yourself that this product is appropriate.

 

...

via https://www.pololu.com/category/239/a-star-328pb-micro

 

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

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

The actual 328PB's (*) are listed up to 20 MHz for supply voltages from 4,5 V on (https://www.microchip.com/wwwproducts/en/atmega328pb)

 

What is the CLKSEL[3:0] setting in the LOW Fuse? Maybe "Full Swing Oscillator" would be the right choice!? 

 

Did you set up the "Clock Failure Detection"?

 

 

 

 

 

(*) edit

Last Edited: Sat. Apr 14, 2018 - 10:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the CLKSEL[3:0] setting in the LOW Fuse? Maybe "Full Swing Oscillator" would be the right choice!? 

No such thing in the PB.

 

The actual 328PB's (*) are listed up to 20 MHz for supply voltages from 4,5 V on

For an external clock, yes.  For the oscillator formed from the internal inverter amplifier and an external crystal or ceramic oscillator, 16 MHz is the spec'd maximum.

"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: Sun. Apr 15, 2018 - 05:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey thanks for the info. I was wondering if you had to still place a 18-22pF for it to burn a bootloader? I used the exact oscillator you have and I had errors uploading the minicore bootloader but when I added an oscilloscope probe which had a 14pF capacitance it burn successfully. So I was wondering if you had a similar issue