This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430f5x fast RTC

Other Parts Discussed in Thread: MSP430F5659, MSP430F5342, MSP430F5529, MSP430F2418

Hi,

I have problem with faster RTC (about 10 - 15 seconds per day). I have tested it on MSP430F5659 (custom board with 2 different 32kHz crystals)

MSP430F5342 (custom board with 2 different 32kHz crystals) and finally on MSP430F5529 launch pad. 

On all of these boards we use 32kHz crystal and calendar mode RTC. Basic setting for 5659 is:

while(BAKCTL & LOCKIO) BAKCTL &= ~(LOCKIO); // Unlock XT1 pins for operation

UCSCTL6 &= ~XT1OFF; // enable XT1CLK

UCS_LFXT1StartWithTimeout(UCS_XT1_DRIVE3,UCS_XCAP_3,5000 == STATUS_FAIL); //Initializes the XT1 crystal oscillator with timeout

UCS_clockSignalInit (UCS_ACLK, UCS_XT1CLK_SELECT, UCS_CLOCK_DIVIDER_1); // ACLK = XT1CLK

RTCCTL01 &= ~RTCHOLD; // strat RTC to operate

RTCCTL0 |= RTCOFIE; // enable RTC fault interrupt

RTCPS1CTL = RT1IP_2 + RT1PSIE; // out from RT0PS, /16 (1/8s) needed for periodic system wake up

Did I miss something? Thank you.

Jano

  • Are you sure the Xtal clock runs well and is selected as clock source?
    I don’t know what’s behind the function ‘UCS_LFXT1StartWithTimeout’ but ‘5000 == STATUS_FAIL’ will be evaluated to ‘0’ or ‘1’ and one of this values is passed to the function.
  • On MSP430F5659 there is no way to change source (32kHz) for RTC. On the scope I have the same waves as with MSP430F2418 device. There is no way to measure with 10ppm resolution. So, I think 32kHz XT1 is running correctly. Just that strange faster 10s/day.
    UCS_LFXT1StartWithTimeout is DriverLibrary function. During debug session - threre is no problem in RTC startup. Even, I have turned on interrupt from oscillator failure with message on serial line - it does not appear. Also, if oscillator would break - RTC should show SLOWER operation, but I observe faster.
  • Did you try to Calibrate the RTC clock?
  • No. It is not a good approach, if I use 10ppm crystal and observe over +110ppm. I would like to see cca 10ppm operation and then I can make calibration. By the way - I tested calibration feature and it worked.
  • The crystal frequency is dependent on the capacitive load on the crystal. In fact, I'm using an adjustable capacitor on the crystal to fine-tune an external RTC. Precision is better than 0.5s/d (limited by equipment precision and by the fact that the capacitor is for the whole load capacitance while a smaller one and a second fixed one would allow even more precise adjustment)
  • Thank you for care.

    How did you make adjustable capacitor? There should be 2 (to be symetrical)?

    Could you send me your setup code for your tests, please? I am affraid that I have missed something in settings....

    By the way - I think the problem comes from interference from power supply leads to processor. I have checked layouts on 5529 launch pad and noted that crystal is shielded with analog GND pins around XT1pins. There is no mention anywhere about AGND pins next to XT1 and shielding. So, in the mean time I made new pcb - now it is in production and this Friday I should have new board. I will make new tests and hope it will help. I will let you know. 

    We made about 800 equipments with MSP processors. All of them were 1xx and 2xx families. And never observed FASTER clock. And accuracy was cca 1-2s/d slower, which corresponds to used X1 accuracy (20ppm in that case). So, that's why I am really surprised with higher clock. 

    Final note - on 5529 launch pad there are EXTERNAL capacitors. The qeustion is why? Could it be that for example internal capacitors are lower quality? I do not believe this theory, but really there is no reason to have external capacitors on 5529....

    Jano

  • Hi,

    after some time, I have new board with shield on X1. It was strange, because I hoped it will help. But did not. Then I continue development on other things in software and get very strange situation. Once I uploaded firmware to processor (my setup is IAR with USB FET), I could debug the code. Then, returned to compiler, made some small changes and again uploaded firmware to processor. Once debugger started - it was no more operating. I could stop execution, but I could not identified where the code is and why initial "printf" is not on serial line... So, I tested this several times and observed that after second upload - debugger is not working. Only power cycle helped..... Then I have got an idea to check my MSP430.dll. I had a version 3.314. Then I updated to 3.434. From this moment I have not observed any problem with debugger. 

    What is more strange - now I am testing RTC. At the moment only with frequency generator, but the error is about 10ppm. Before it was about 30-50ppm. I have a plan to calibrate RTC with GPS receiver with 1pps signal, but it will take some time. 

    Jano

  • "How did you make adjustable capacitor? There should be 2 (to be symetrical)"

    Adjustable capacitors in the low pF range are available. They consist of two stacks of half-circles that interleave. You can rotate one, so the half-circles do partly or fully overlap or not at all, giving you an adjustable capacitance. You're right, for symmetry, there should be two, but tuning only one side does the trick. It's conforming with the reference implementation in the datasheet.
    Maybe it results in a slightly asymmetrical oscillation, and reduces the safety margin, but is still within the operating range of the internal circuitry. Or the internal circuitry isn't a Pierce oscillator. There are other kinds of crystal oscillation circuits than the Pierce oscillator that is used on the MSPs. Some of them only require a one-side load.

    "5529 launch pad there are EXTERNAL capacitors. The question is why?"
    XT1 can be used for LF or HF crystals, and for HF crystals, you'll need external capacitors. Maybe that's why there are pads for them. Also, you might use an LF crystal that requires a different load capacitance than available from the internal caps, so you need to disable them and use external ones.

    "never observed FASTER clock"
    A crystal can oscillate in parallel or serial resonance. The two frequencies aren't that far apart. If a crystal is detuned too much by its load capacitance, it may 'snap' towards the other one. This _could_ be an explanation.
    Or the crystal gets additional 'kicks' by crosstalk.
    However, your experience with the debugger may point into a different direction: On the 5342 and 5529 (don't know about the 5659) is an RTC_A. It is driven by ACLK rather than XT1 directly (as on RTC_B or RTC_C). The debugger (if attached) may affect ACLK operation, it may even cause ACLK to switch from XT1 mode to REFO mode. This could be a reason. The newer DLL might handle things a bit differently and now you're finally really operating on XT1.
    Sometimes it is good to have other means of debugging, so after upload, you disconnect the debugger and make a cold boot before testing vital operating parameters. As this is the condition the device will run on later.
    When starting with 5x family, I used the PWM to output a 16 bit test value (and an external frequency meter), until I got the RS232 working. I still use LEDs/port pins to signal entry and exit points for timing/jitter testing. In fact, I never used a debugger on any of my MSP projects. It's of no use on realtime applications anyway.

**Attention** This is a public forum