The DS3231 is an RTC chip with an onboard temperature compensated oscillator and 32kHz output.

I want to use this chip in a small clock project I'm designing because I've got a couple lying around. Since it's got the the 32kHz output, I want to use that as a main clock source for the microcontroller (PIC18F4550) and skip the discrete XTAL to save on space and BOM.

All the examples I have found use a higher-speed crystal to drive the main microcontroller and ignore the 32kHz output of the RTC, although sometimes the 32kHz is used to drive other circuitry.

This is making me doubt my design decision, but I haven't found anything that outright says I can't do it. Are there any gotchas I should know about before I fab the board? I realize that by using this method I don't have a second clock source to tune the oscillator. I do plan on prototyping it.

Here is my schematic:

enter image description here

(The TPS chip is a 3.3V regulator connected right up to the 9V battery. EN should read /EN)

  • \$\begingroup\$ Check that your PIC supports this kind of extremely slow clock, but if it does then this should work. Obviously executing at 32khz is going to be very slow. \$\endgroup\$
    – pjc50
    Dec 6, 2013 at 17:07
  • \$\begingroup\$ Assuming the PIC doesn't have anything fancy like DRAM, which needs refreshing periodically, I don't think the clock rate matters too much. I've yet to come across a PIC that isn't synchronous. \$\endgroup\$
    – Polynomial
    Dec 6, 2013 at 17:12
  • \$\begingroup\$ All it will do is display time/date on 7 and 16 segment displays so I'm going to be very surprised if 32kHz is not enough. \$\endgroup\$
    – BB ON
    Dec 6, 2013 at 17:27

1 Answer 1


This PIC, and all other PIC18's that I know of, have an internal oscillator block. There is no need for an external crystal, even if you didn't have the 32kHz output. The only time you would need to use an external XTAL or clock would be:

  1. To synchronize multiple devices to the same clock,
  2. If you need a very specific frequency (for serial communications, etc), or
  3. If you need more accuracy that the internal oscillator would provide.

You configure this INTOSC block by setting bits in the OSCCON register. You can choose from eight values from 31kHz to 8MHz to run the system clock.

In the OSCCON register, set the SCS1 bit to use the internal oscillator block. Then, set the IRCF2:IRCF0 bits to choose your frequency. This picture is from Section 2.4.1 of the datasheet:


This is convenient because you can choose a slow frequency for lower power usage, and then increase it if you need to.

You could, of course, use the 32kHz RTC output, but it may just be unnecessary complexity. Also, keep in mind that the PIC18F4550 has a different oscillator architecture than other PIC18's because of the way it clocks it's USB module. This won't stop you from using the 32kHz signal, but it will require a different configuration that you may be used to.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.