Why no 32Khz clock?

cancel
Showing results for 
Search instead for 
Did you mean: 

Why no 32Khz clock?

670 Views
robertmorrison
Contributor II

I have a custom board with an LPC4357 208pin device with about 128K of code running USB, SPIFI, LCD, UARTs all working well.  I am trying to get the RTC to work, but cannot get the 32Khz clock to pulse.  I am driving the RTCX1 input with a 32Khz crystal oscillator and routed the 32Khz clock out to both a CLKOUT and a CLK_CGU_OUT0.  I cannot get either output to toggle.  If I select either output to IRC, both outputs toggle, so I know the port setup for the outputs is working.  I can see the RTCX1 input toggling so I know the RTC clock input is there.  I checked VBAT, is is showing 3.3V.  I use this code near startup:

// Cycle the RTC 32Khz osc power, enable 32Khz
   LPC_CREG->CREG0 = 0xf04;
   LPC_CREG->CREG0 = 0xf03;

I used the debugger to confirm that the CREG0 values are correct.  I've written many permutations of this, delaying bits, waiting seconds before writing, etc, but the 32K clock never toggles, and the RTC register writes always lock up the chip.  I tried some experiments with the RTC Alarm, but reading or writing those registers causes the chip to lock up. 

What am I missing?  I've been fighting this for a week, and did a search on this forum for similar issues, but no-one else seems to have run into this.

Labels (1)
0 Kudos
3 Replies

448 Views
robertmorrison
Contributor II

More information.  The problem is the RTCX1 input threshold.  If I tie this low, then the RTCX2 output goes high and the OUTCLK and CLK_GCU_OUT0 both go high.  However, driving the RTCX1 input with a CMOS level crystal oscillator, which goes very close to rail-to-rail (0.1v to 3.2V) causes no output on the RTCX2 output or the OUTCLK or CLK_GCU_OUT0.  I put a 32.768Khz crystal on these pins along with two 20pF capacitors, still no output.  I see no documentation anywhere on how to drive the RTCX1 input, I had to guess this is a typical crystal inverting buffer.  I tried driving RTCX1 with the crystal oscillator (recommended by several posts on this forum, no luck.  I tried driving it through a small capacitor, various RC circuits, etc, nothing works.  I looked at several dev boards such as the Keil LPC1857/4357 boards, they just show a crystal with two 20pF caps, which doesnt work on my board.

How am I supposed to drive RTCX1?

0 Kudos

448 Views
robertmorrison
Contributor II

I went back to using a crystal and 20pF caps, and now I get the 32Khz clock.  I still get a hard fault trying to access the RTC timer registers (after waiting several seconds), but that's probably some sort of setup error.  Looks like driving the RTCX1 with a crystal oscillator does not work?

0 Kudos

448 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I'd highly recommend you to refer to the periph_rtc demo in the LPCOpen library if you use an external crystal.
When using a 32.7 KHz oscillator, the input signal should  meet these below requirements.
1. The input voltage to the on-chip oscillators is limited to 1.2 V
2. The recommended amplitude of the clock signal is Vi(RMS) = 100 mV to 200 mV with a coupling capacitance of 5 pF to 10 pF.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos