PWM kills RTC oscillator

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PWM kills RTC oscillator

941 Views
kkramb
Contributor II

I have a custom MCF52258 board design.  It has an oscillator circuit with a 32.768 KHz crystal that drives the internal RTC.  The oscillator and the RTC work normally until I turn on a particular PWM output. When the PWM output is enabled the oscillator circuit stops oscillating and therefore the RTC stops counting seconds.  The PWM is operating in the range of 5 - 50 KHz with a 50% duty cycle.  This problem occurs with PWM2 and does not occur with PWM4 or PWM6.  The microcontroller is the 144 pin LQFP.  On this package PWM2 (pin 12) is right next to the RTC_EXTAL pin (13).

 

Do you have any suggestions for how to fix this problem?  Right now my best idea is to revise the board to use a different PWM channel. :smileysad:

Labels (1)
0 Kudos
5 Replies

476 Views
TomE
Specialist II

The PWM output is interfering with the RTC oscillator.

 

There are three parts to any electrical interference problem - generation, coupling and sensitivity. There's also measurement.

 

Generation. Change PDSR[17]. This changes PWM2 between High and Low Drive Strength. What is that pin driving" Is it something that draws a large current? Is it a long track with a high capacitance? You probably should have a resistor in series with this track very close to the CPU to limit the current spikes.

 

Coupling. How close (and over what distance) is the PWM2 track running to the RTC track? What is the grounding of the RTC components like?

 

Sensitivity.Your oscillator is sensitive to interference. It may be unduly sensitive. Is the crystal case grounded? Are there any "ground shield planes" under the crystal, capacitors and tracks? RTC_EXTAL is the input to the oscillator from the RTC. This is a higher impedance than the RTC_XTAL output signal, so it is expected to be a bit sensitive. The amount of signal coupled to it from PWM2 depends on the mutual inductance and capacitance of these two traces together with the impedance of the RTC_EXTAL signal. The main influences on that are the crystal impedance and the parallel capacitance.See (from your crystal specifications) if you can increase the capacitance on this pin at all.

 

Play with the KHZEN, REFS and LPEN bits in the RTCCR in case they are set to the wrong values for your crystal.

 

Measurement: Can you see the interfering signal with an oscilloscope? It is likely the oscilloscope probe will either stop the clock on its own, or might even make the problem go away.

 

Finally, if the RTC oscillator is so sensitive to that signal it may suffer interference from other signals as well. It might be sensitive to induced noise and even temperature changes.

 

Tom

 

0 Kudos

476 Views
MArut
Contributor I

 

Hi , In your answer you have stated that "RTC_EXTAL is the input to the oscillator from the RTC. This is a higher impedance than the RTC_XTAL output signal, so it is expected to be a bit sensitive."

 

Can you please describe why it is more sensitive as it is higher impedance? 

 

Regards,

MArut

0 Kudos

476 Views
FridgeFreezer
Senior Contributor I

I'm no expert, but a higher impedance input pin = lower load = takes less power to waggle the pin state about.

0 Kudos

476 Views
kkramb
Contributor II

Thank you.  This is great advice and more than I was expecting.

I had tried LPEN in RTCCR but have not tried the drive strength, PDSR[17].  The hardware designer is considering cutting back some ground plane to reduce board capacitance.  And I'm going to pass along your other comments to him for consideration.

 

0 Kudos

476 Views
TomE
Specialist II

The most important thing is the MEASURE what is going wrong.

 

Put an oscilloscope probe on the PWM and RTC pins and see if you can see the interference.

 

It may be necessary to buy or build a high impedance (at least 10M and less than 5pF) probe.

 

Trial and error takes a long time, especially if it is waiting on a new board revision to see if the change worked.

 

Tom

 

0 Kudos