EMI Problem?

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

I'm using this crystal to drive my mega644 : http://cfm.citizen.co.jp/english/product/pdf/HC-49_U-S.pdf

I'm using the 14.7456 MHz version of it and I'm seeing my chip freeze every now and then when other activity occurs on the 24V power line that supplies power to a 24V -> 5V power supply that feeds this circuit board. (This activity is a gang of 24VDC contactors that energize every now and then - I don't see any issues on the line with my scope but the energizing is definitely when the freeze occurs but it only happens 5% of the time or so)

This crystal was a replacement for another crystal that was discontinued. I never had freezes when using the other crystal and I was using 18pF caps for it and continued to do so for this new one. Looking at the spec sheet, it looks like I should be using 10pF caps instead.

I'm going to get those smaller caps on order from Digikey and swap them in but I was wondering if this higher capacitance would make this new crystal more susceptible to freezing if the 5V power was a little noisy from time to time due to those contactors energizing.

Last Edited: Sat. Nov 23, 2013 - 12:33 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd be surprised if a brand-change in xtal mattered (especially a same-size one).
You may have just been lucky before.

A useful XTAL checker, is a fast diode (BAW62/1N4148) and a multimeter. Alternate the meter to Vdd and Gnd to Check Vpk excursions on each pin, going each way.
This has very low loading.

Also check the Frequency, via a toggle pin, to see where you are.
Correct C load, should give exact freq, but keep in mind the ppm tolerance and ppm/pF can make this a broad target.

Testing a few Crystals from a production batch can help.

Contactors are truly nasty things for dV/dT wavefronts.
Distance helps.

I would try a swap of CMOS OSC as xtal, to get an handle on just how sensitive the Xtal node is, and also focus on the RST pin.

Last Edited: Sun. Nov 17, 2013 - 08:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your crystal should be fine with 18pF. These only represent a 9pF load.

I would concentrate on your power supply. e.g. a BFC to cope with glitches. And obviously your regular local 100nFs on all the i.c. supply pins.

If your AVR is supplied via a 7805 from the 24V supply, you could add a diode and BFC on its input.

It is always preferable to have BFC on a 7805 input rather than output.

David.

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

fizgig wrote:
I'm using this crystal to drive my mega644 : http://cfm.citizen.co.jp/english/product/pdf/HC-49_U-S.pdf

I'm using the 14.7456 MHz version of it

The datasheet is generic for typical parameters you can order the crystal from this series, and you must know with what kind of parameters your crystal was ordered. It really tells nothing about the crystal you have.

Where did you order this crystal from and with what code? For example Digi-key could stock many versions of this crystal series, and many versions of 14.7456 MHz crystal, for example you could order this with 18pF load capacitance or 30pF load capacitance.

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

I do have a 0.1uF cap (100 nF last I checked) on the mega644. It's "C6" on the attached pic. You can also of course see the crystal "X2" right next to the AVR.

This is a pain to troubleshoot now as I can't get it to glitch anymore.

Attachment(s): 

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

Here is the digkey part number I ordered: 300-8496-ND

You're right, it does specify load capacitance on Digikey's description and it's the same 18pF I've been using.

Jepael wrote:
fizgig wrote:
I'm using this crystal to drive my mega644 : http://cfm.citizen.co.jp/english/product/pdf/HC-49_U-S.pdf

I'm using the 14.7456 MHz version of it

The datasheet is generic for typical parameters you can order the crystal from this series, and you must know with what kind of parameters your crystal was ordered. It really tells nothing about the crystal you have.

Where did you order this crystal from and with what code? For example Digi-key could stock many versions of this crystal series, and many versions of 14.7456 MHz crystal, for example you could order this with 18pF load capacitance or 30pF load capacitance.

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

Who-me wrote:

A useful XTAL checker, is a fast diode (BAW62/1N4148) and a multimeter. Alternate the meter to Vdd and Gnd to Check Vpk excursions on each pin, going each way.
This has very low loading.

Neat idea. I used a fast-acting diode and can now see the frequency without killing the clock. Sure enough, I see ~14.75MHz on my scope. Now I just need to get it to freeze again and see if the clock signal is still there.

Attachment(s): 

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

The clock looks really distorted. Your scope might use a bit too low sampling rate to see this, or the waveform really is bad.

18pF crystal should be fine, but you said two 18pF caps are there so those only create 9pF of load to the crystal. I am not sure if all the stray and pin capacitance will add up the other 9pF. But I do not think this makes it any more susceptible to EMI either. Considering that Atmel recommends max 22pF capacitors, and stray capacitances are in the order of 5pF usually, maybe a crystal with 18pF load rating is a bit on the high side.

The crystal layout is something that could be improved. Do check Atmel application note AVR186 if you think something might apply.

Do you have the full swing crystal option turned on?

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

I am very sceptical.

The mega644 should oscillate just fine with your 14MHz crystal. Either with "Full Swing" or regular "Ext. Crystal 8-20MHz"

As Jepael says, the AVR and pcb capacitance is likely to be 5pF. The two series-connected 18pF add 9pF.

You can view your clock signal from XTAL2 with a x10 probe or CLKOUT pin with x1 probe. You never put any probes on XTAL1. I would be wary of the 1N4148+multimeter too. (but this is because I have no idea how you have physically implemented it)

You might have one duff crystal. I doubt that you would ever get a whole batch of duff crystals. Or duff 18pF capacitors.

David.

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

Sounds like a power supply problem to me. Needs a BFC.

I tried finding out a while ago how to figure these crystal caps, but wound up just ordering 22pf.

You take the "load capacitance" figure from the crystal data sheet, subtract 5pf to account for the pins and board capacitance, then multiply by 2?

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

david.prentice wrote:
I am very sceptical.
The mega644 should oscillate just fine with your 14MHz crystal. Either with "Full Swing" or regular "Ext. Crystal 8-20MHz"

Well, I have it set to "Ext Crystal 8-20MHz" - the last option in the AVR stk-500 programmer settings.

david.prentice wrote:

You can view your clock signal from XTAL2 with a x10 probe or CLKOUT pin with x1 probe. You never put any probes on XTAL1. I would be wary of the 1N4148+multimeter too. (but this is because I have no idea how you have physically implemented it)

I now am monitoring the CLKOUT pin with the x1 probe. I'm getting the same looking smooth curve but it now goes from 0V to 5.5V. Should I be seeing a square wave instead?

Attachment(s): 

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

If you see a 14MHz 5V p-p sinewave on CLKOUT, this just means you have crap probes / oscilloscope.

It also means that you are oscillating just fine. (when you see 5V squarewave with good probe)

If you have am inactive crystal, "Full Swing" will be a stronger drive than "regular 8-20MHz".
OTOH, it will use slightly more current. Not really important for most apps.

David.

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

Well, it's a moot point I guess. I'm able to get the board to freeze more easily now by engaging and disengaging a large 24VDC capacitor. The crystal on my mega644 still pulses away on my scope so it doesn't appear to be a crystal problem.

My board has both the mega644 and an ethernet controller (enc28j60) on it. Both seem to freeze at the same time. Both have their own crystals. The enc28j60 even has its own 3.3V regulator off the 5V bus with lots of headroom and it still gets taken offline (the leds for the ethernet connector go dark).

Maybe I need an inductor on the 5V that goes into my circuit board.

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

fizgig wrote:
Well, it's a moot point I guess. I'm able to get the board to freeze more easily now by engaging and disengaging a large 24VDC capacitor. The crystal on my mega644 still pulses away on my scope so it doesn't appear to be a crystal problem.

Expecting a Linear-amplifier oscillator to cease oscillating just because of a spike, is not logical.
There is a failure mode where a very short coupled spike, passes into the core as a runt clock pulse, shorter than the Spec min, and that can cause incorrect opcode action.

Arcing contacts (contactor, or a large Cap) are nasty sources of high dI/dT and dV/dT.
Improve distance, and planes and shielding - think of it like RF, and of very short duration.

Does the Ethernet device have a reset pin ?
In some cases power-removal recovery is the only way to bring the system back.

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

Quote:
Does the Ethernet device have a reset pin ?
In some cases power-removal recovery is the only way to bring the system back.

It does indeed have a reset pin but I can't get to it because my AVR freezes at the same time.

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

fizgig wrote:
Quote:
Does the Ethernet device have a reset pin ?
In some cases power-removal recovery is the only way to bring the system back.

It does indeed have a reset pin but I can't get to it because my AVR freezes at the same time.

Then an external watchdog could be called for.

Of course, you should harden the design first, so the wdog is very rarely called on.

I would add an Osc module, during aggression testing to remove one source of failure mode.

Then, when you have it 'hardened' enough, reapply the Xtal and check the failure level does not degrade.

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

Well, I've noticed that the freeze (when I can get it to occur) is when the 24V relay nearby (5 ft away) releases. This tells me there's a power spike on the 24V bus even though I have a fast-acting flyback diode on the relay coil.

That 24V bus is attached to a couple of pins on my circuit board that feed into a shift register (after being divided down from 24 to 5V) that then communicates to my AVR directly. The 24V bus also powers a 24V to 5V switching power supply that feeds the AVR its 5V.

Those are the two paths into the AVR from the 24V bus. Both are indirect. Can it really be a voltage spike? My scope never catches a spike but it's a crappy scope so perhaps there is a spike I can't detect.

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

fizgig wrote:
Well, I've noticed that the freeze (when I can get it to occur) is when the 24V relay nearby (5 ft away) releases.

What load is the relay switching ?

fizgig wrote:

Can it really be a voltage spike? My scope never catches a spike but it's a crappy scope so perhaps there is a spike I can't detect.

Think of it more as RF than a Spike, and consider all of the cables as inductors and aerials.
Pulses in the 1-10ns region can be hard to remove.

Try a snubber on the relay contacts to reduce arcing, and also inductively isolate the relay-load power, from the power that feeds your board.

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

The relay is actually turning on and off 480VAC. There is no load though as the load is disconnected downstream. I turned off the load for this troubleshooting by opening a circuit breaker downstream and it still happens anyhow.

Not sure how to apply a snubber to the relay contacts. I'll look that up.

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

What if I make a grounded EMI shield around the relay? Perhaps that wont work since the RF could still make it out through the coil wires or the load wires.

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

fizgig wrote:
The relay is actually turning on and off 480VAC. There is no load though as the load is disconnected downstream. I turned off the load for this troubleshooting by opening a circuit breaker downstream and it still happens anyhow.

Not sure how to apply a snubber to the relay contacts. I'll look that up.

So the relay still has 480vAC applied to it, and wires connected, just no current from a remote load that is disabled further downstream ?
Even cables alone can give issues.
The highest dV/dT effects occur when a contact bounces, and during the bounce time the source voltage changes significantly.

At next closure, the cable has hundreds of volts applied, and the earliest transmitters were 'spark gap' based.

Try removing all 480V lines, to confirm it is dV/dT effects.

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

Well, I think I have it fixed through the addition of a ferite choke on the 5V wire that powers my circuit board.

Before this I couldn't get more than 50 relay actuations before a freeze would occur. I just went to 500 with no issues.

I also noticed that infrequent reboots that I assumed were due to brownouts have also greatly reduced.

Thank you so much for your suggestions. I'll keep them in my hip pocket in case the problem pops up again.

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

If you can still edit the topic heading, you might like to change it to more reflect the real problem.

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

Quote:

I also noticed that infrequent reboots that I assumed were due to brownouts have also greatly reduced.

Why aren't you trapping/logging/reporting reset causes in a situation like this? No need to "assume". And "no reset cause" is runaway code.

And the watchdog...Is it enabled? Is it firing? IIRC '644 has WD interrupt features so you can find the "come from" address in addition to the reset cause.

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.