Mysterious "Ghost" Internal Oscillator in RTCC  - Page 1
Forum section: electronics / beginners

author: tarun172
author_rank: Regular Contributor
timestamp: February 17, 2020, 03:30:30 pm
content: Hi,I am working on a new design that involves a MCP79XXX series serial RTCC chip from Microchip. While writing interface to this RTCC chip, I ran into issue where RTCC would not count. As I start to dig in a little bit more, there were two problems:1. I need to turn ON start start oscillator bit in seconds register in addition to setting external oscillator in control register.2. I found that values of load capacitors connected to crystal oscillator were not of correct value. This, I found out much much later.After spending some time to solve this issue; I turned off external oscillator in control register and turned ON start oscillator bit. To my surprise RTCC started "counting"; meaning seconds counter was incrementing. I tested on two boards to verify that RTCC was indeed counting.Thing that got my head scratching is my opinion RTCC should not count because (1) Load capacitance value is wrong far below recommended limit. Therefore, crystal oscillator should not oscillate. I verified this using Oscope on two boards that I tested, (2) External Oscillator is turned off.As anybody seen this before? Microchip confirms that there is not internal oscillator. So how would RTCC just magically start to count? Am I missing something here?tarun172

author: hexreader
author_rank: Frequent Contributor
timestamp: February 17, 2020, 03:39:26 pm
content: Exactly which RTCC chip?Please post full, accurate schematic.

author: DrG
author_rank: Super Contributor
timestamp: February 17, 2020, 04:17:03 pm
content: Quote from: tarun172 on February 17, 2020, 03:30:30 pmIn addition to what the previous poster requested...I'm not certain exactly what you are asking? RTCC does not magically start, it needs either an external crystal or an external clock source. Failing one of those, it is not going to count.Have you looked through the "Common Issues" AN1496http://ww1.microchip.com/downloads/en/Appnotes/00001496B.pdf?and also "Question and Answers" TB316http://ww1.microchip.com/downloads/en/Appnotes/90003116A.pdf."1. I need to turn ON start start oscillator bit in seconds register in addition to setting external oscillator in control register."That sounds like one problem that you had."The oscillator must be started by setting the STbit in the RTCSEC register if a crystal is being used, or by setting the EXTOSC bit in the Control register, if an external clock source is used. Also, refer to the following documents:AN1365 – “Recommended usage of MicrochipSerial RTCC Devices” (DS00001365) and AN1519 – “Recommended crystals for Stand-Alone RTCCs” (DS00001519)."So, it is one OR the other, depending upon whether you are using a crystal or an external clock source, but not both.It sounds like you figured that out....After spending some time to solve this issue; I turned off external oscillator in control register and turned ON start oscillator bit. To my surprise RTCC started "counting"; meaning seconds counter was incrementing. I tested on two boards to verify that RTCC was indeed counting.But, it is not surprising and they even say..."Make sure the Start bit (ST) in register 00h is set; set ST = 1 to enable the oscillator.• Check if the EXTOSC bit in the Control register (07h) is clear; EXTOSC =0. This should be cleared when using an external crystal."Thing that got my head scratching is my opinion RTCC should not count because (1) Load capacitance value is wrong far below recommended limit. Therefore, crystal oscillator should not oscillate. I verified this using Oscope on two boards that I tested, (2) External Oscillator is turned off.Not sure how you determined the load capacitance value (1) but for (2), as stated, EXTOSC must be cleared if using a crystal.Assuming that I have not completely misunderstood you, hope this helps.Edit: Re-reading your post, it is possible that what you are "missing" is simply their distinction between a crystal source and an external oscillator source. Yeah, since they do not have an internal oscillator, both could be considered "external", but clearly they are looking at the distinct cases of using a crystal and pins X1 and X2 versus "X1 also serves as the external clock input when the MCP7940X is configured to use an external oscillator"

author: tarun172
author_rank: Regular Contributor
timestamp: February 17, 2020, 05:03:46 pm
content: Hi Dr. G,Thanks for bringing this to my attention. I went completely off datasheet of MCP79XX Series and chip errata. It says "Note: The EXTOSC bit must be set to enable an external clock source". So the info, "Make sure the Start bit (ST) in register 00h is set; set ST = 1 to enable the oscillator.• Check if the EXTOSC bit in the Control register (07h) is clear; EXTOSC =0. This should be cleared when using an external crystal." should be in errata. Very strange.I determined load capacitance per section 5.2 equation,CL = CX1 X CX2------------- × C STRAYCX1 + CX2Where:CL = Effective load capacitanceCX1 = Capacitor value on X1 + COSCCX2 = Capacitor value on X2 + COSCCSTRAY = PCB stray capacitanceThey also say suitable crystals have a load capacitance (CL) of 6-9 pF. Inadvertently, I selected 2 pF load crystal instead of 6-9 pF.tarun172

author: DrG
author_rank: Super Contributor
timestamp: February 17, 2020, 07:53:28 pm
content: I think that you have it figured out.Just an interesting aside. I see the 5.2 equation. Take a look athttp://ww1.microchip.com/downloads/en/Appnotes/00001519B.pdfand Equation 1. Notice that they had added the pin capacitance to the formula (citing it as 3 pF typical).Actually, in my view, Microchip is pretty good with their data sheets (*ducks to avoid thrown objects*) at least compared to some others. Especially so when the product is mature and there are some supplementary notes out there.

author: floobydust
author_rank: Super Contributor
timestamp: February 17, 2020, 09:52:19 pm
content: It's a bit hilarious these Microchip RTC's are super cheap and full of bugs. I've learned the extra debugging time and product failures ain't worth BOM cost savings.Just how hard is it to make a decent RTC after all the decades they've been around?erratashave major issues. OP didn't give us the part number he's using."...errata described in this document will be addressed in future revisions of the MCP7940N silicon."Silicon rev. not in the part number or a register, good luck tracking that down.

author: tarun172
author_rank: Regular Contributor
timestamp: February 17, 2020, 10:12:16 pm
content: I realize now that document was somewhat confusing. MCP79XX series can be driven by two sources external clock or an oscillator. When they say Disable external 32.768 kHz input what they really mean is disable external clock input and enable external oscillator. MFP Block diagram in datasheet covers this in detail. EXTOSC is logically connected to OR gate input. It is just confusing the way datasheet has been written.bit 3 EXTOSC: External Oscillator Input bit1 = Enable X1 pin to be driven by external 32.768 kHz source0 = Disable external 32.768 kHz inputThank you all. @hexreader @floobydust @DrG