Got 0x0C External Clock

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

RANT: I'm so tired of the atmega328p chips. It seems like every board I design with these chips fails in a random and unpredictable fashion. I have had amazing success with the ATSAM4S4AA-MU and ATTINY10/85 chips and will likely be switching all of my projects over to those. AGH!

 

The problem: Board programs just fine on internal oscillator and it runs too! When I switch to an external clock source SIT8008B (fuse bits on external clock, CKDV8 disabled) , the board behaves as though it's not receiving any clock pulse and refuses to program. I have the oscillator programmed at 7.3728MHz (best results for most common UART speeds)

 

Thoughts:

  1. The external clock isn't reaching the minimum/max Vol/Voh levels. 
    1. Acceptable Vih=vcc*0.7 (Pg313 of the datasheet)
    2. Acceptable Vil=vcc*0.1 (pg 313 of the datasheet)
    3. The SIT8008B in 3.3V mode runs 0.9VCC(high) to 0.1*VCC(low)
      1. This could be a problem as the oscillator may not be dropping below the low threshold, but should be exceeding the high threshold!
  2. The sit8008b is not driving the input hard enough (Vih not being reached)
    1. The only thing remotely close to an equivalent internal resistor is a pull-up which sits around (20-50K, Pg 314)
      1. Again this may cause the clock to not be able to drive the chip low enough.
      2. The SIT8008B's drive strength setting is on 1.86ns into a 30pf load (not going to back out the current here)
  3. This external clock functions perfectly every time on my ATSAM4S boards
  4. I'm hesitant to use a pull-down resistor. 
  5. I've programmed this oscillator for higher frequencies (12MHz)
  6. I measured the clkout with a Saleae logic analyzer (logic mode, 500MHZ, analog mode, 50MHZ)
    1. The analyzer sees it as a HIGH constant. Ohh this is interesting!
      1. DO I HAVE TO DISABLE THE PULL-UP resistor on XTAL1 before I set the fuses?? Why is it on by default? It's not on by default on any of the other pins
      2. I'm getting periodic spikes every 2 or so ms way off of the set clock frequency.

 

Does anybody have any experience using external oscillators? If so what were your challenges?

 

I've attached the schematic and the layout (top layer). ONE IMPORTANT NOTE: I've since revised the design and attached the external clock output to XTAL1, NOT XTAL2 as shown in the schematic/board. I am testing this corrected revision. 

 

I have also attached the logic analyzer screenshot.

 

 

Attachment(s): 

This topic has a solution.

;Conrad Farnsworth

Last Edited: Mon. Nov 5, 2018 - 07:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

radacon wrote:
The external clock isn't reaching the minimum/max Vol/Voh levels.
Shouldn't you be telling us the Vcc level of your application?

 

radacon wrote:
I've since revised the design and attached the external clock output to XTAL1, NOT XTAL2 as shown in the schematic/board. I am testing this corrected revision.

Before ranting, shouldn't you be connecting your external clock to the correct pin?

 

 

 

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

please post your fuse settings.

do you have the BOD enabled?

I can not tell from pcb layout if osc and M328 share the same gnd? 

 

Jim

Edit:  added gnd question

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

Last Edited: Mon. Nov 5, 2018 - 07:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm also going to assume that you tried the system with the clock's Pin 1 tied High, in case the chip happens to be in the OE or ST\ mode, and not in the NC mode, in which case it has to be tied high to generate an output.

 

JC

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:

Shouldn't you be telling us the Vcc level of your application?

VCC=3.3V it's evident on the schematic.

theusch wrote:

Before ranting, shouldn't you be connecting your external clock to the correct pin?

Mistakes are common, I do my best to fix them. In this case, I applied the fix and that didn't work. It's ironic and frustrating that my more complex boards have a higher success rate and are easier to debug. Also, my last few form posts have been ranting about this batch of chips not running at all. I'm upset because I consistently fail to find concrete evidence of things not working so it's hard to find a design that works right out of the gate for me. 

 

ki0bk wrote:

please post your fuse settings.

do you have the BOD enabled?

Fuse settings are the default. I'll need to resolder a new chip on to get you an exact value. The only changes are switching to an external oscillator and disabling ckdiv8.

 

Update: I've desoldered the chip and placed a wire on the clkout of the external clock. It powers on to high, but doesn't oscillate. Something is fishy here. It would seem that my oscillator isn't oscillating. Which is odd. I'll post the configurations once I find out what works.

 

Well. I figured it out. The ground on the oscillator isn't connected. This explains why the oscillator goes high....I think the quickest way to look like an ass is to complain about equipment. So. Yeah. Mystery solved. 

 

Odd thing is the ground pour covered the pad but eagle didn't whine about there being no connection to actual ground. Hmmmm. 

 

Well thanks for all of your help!

 

Kindly,

 

-Conrad

 

 

 

 

;Conrad Farnsworth

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

Admittedly, we've done many scores of production AVR apps since circa 2000.  The Mega88 family (successor to AT90S4433 and then Mega8) has been around now for nearly 15 years.  As the third generation of the family, many/most(/all?) of the kinks have been ironed out and the rough edges files off.  With any reasonable layout, they indeed "just work".  There must be a reason you are applying an external clock module.  I'd think, then, you'd have a 'scope or at least a frequency counter to ensure that the pin on the micro is getting a clock signal.  Kind of the sanity check, isn't it?

 

Take another unit of AVR, that you can get to work on internal oscillator, as you mentioned.  Set the CLKOUT fuse.  Buss the CLKO to the XTAL1 of the sick AVR unit.  Does that full-swing signal excite the limp AVR and cause it to rise up?  So that is a second way to see if it is your provided clock signal or not.

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

ki0bk wrote:
I can not tell from pcb layout if osc and M328 share the same gnd?

 

I nailed it!  cheeky

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

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

LOOK AT THIS! in the schematic, eagle clearly has the node connected to ground (and indeed it is connected! None of that it-looks-like-it's-connected-but-really-isn't nonsense bug that eagle has). 

 

Eagle, in it's (nearly) infinite wisdom knows where the ground will connect and where it can't (component in the way or something) and will pour or not pour ground in a region. The screenshot attached clearly shows a flaw where eagle ALMOST makes a physical connection to ground and that's close enough right??

 

i feel like I'm taking crazy pills here. 

Attachment(s): 

;Conrad Farnsworth

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

What did the DRC say?

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

radacon wrote:
The screenshot attached clearly shows a flaw where eagle ALMOST makes a physical connection to ground and that's close enough right??

 

I have learned after about 40+ years of doing pcb's, that CAD is a wonderful help, but is not flawless as is any piece of software, it pays to take the time to review any pcb layout before sending it to the board house.

This problem is not unique to Eagle.   Enjoy the process, have fun....

 

Jim

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

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

 It seems like every board I design with these chips fails in a random and unpredictable fashion.

 

 

So, not so random and unpredictable.

At least I'd not view it that way, as careful scrutiny / review would have detected the error.

And if you lay it out exactly the same way, you will (presumably) get exactly the same error.

 

The predictable part of this is that the error is most likely precipitated by the designer.

Now one can argue whether that is the CAD software designer, or the end user designer.

 

I don't make a lot of different board layouts, but I still recall one, prior to my design process including a close "review" of the Gerber files with an independent program, that was totally FUBAR after I rotated the micro and the pads on all sides were shorted together on the actual layout.

 

Since then, I had another board where the review using a separated viewer program than the one that created the layout, helped me spot a problem and fix it before the layout was submitted for manufacturing.

 

I've had to tell myself on several occasions: "That's why its called a prototype!", but it still aggravates me when there is a simple error that I should have identified as part of the overall design process.

 

Truly, be glad you found the underlying source of the error!

Having done so you are better prepared to prevent its reoccurrence!

 

In this case, also, it would appear that there might be a simple fix for the faulty PCBs, which is also good news.

 

JC 

 

Edit: Typo

 

 

Last Edited: Tue. Nov 6, 2018 - 05:58 PM