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.
SDK version : 7_10_00_35
CCS version : 12.2.0.00009
Will RTC be inaccurate due to any peripherals or operations?
I am currently monitoring the CC2340 for a long time. I found that after 9 days, the RTC time differed by 7 minutes from the time on the computer and mobile phone.
During these 9 days, I made a Bluetooth connection to CC2340 and used FFF1 to Write Value to CC2340, and CC2340 would use Notify to return the Value. Will these operations cause problems with RTC time? Read the RTC time as shown below
Hi Ryan,
What is your Low-Frequency Clock Source, XOSC or RCOSC? The RCOSC_LF has an accuracy of ± 600ppm (Datasheet, varies by part). 600(accuracy)x24(hours)x60(minutes)x60(seconds)/1000000(pmm)=51.8 seconds shift per day at maximum RCOSC_LF (in)accuracy without compensating for temperature. If using the XOSC_LF, then accuracy will depend on the specs of the crystal being used and the loading capacitors. Thus RTC accuracy will depend on oscillator source, clock compensation, and temperature variance, but it should not depend on other code operations being used.
Regards,
Ryan
Hi Ryan,
I use LF XOSC Mode,There should be no other place to set the Low-Frequency Clock Source, right?
I am using a 7pF 32768 oscillator and two 12pF capacitors for the load capacitor.
I tested it again. After about 13 hours, after reading the Count value of the RTC 524M register and multiply by 0.524 to convert to seconds, there was a difference of 28 seconds from the computer time.
If RCOSC is used, 600(ppm)*60(s)*60(m)*13(h) is indeed about 28 seconds
But my Syscfg has been set to LF XOSC, and there seems to be no other place to modify it.
Or is the CC2340 not connected to the external 32.768K oscillator at all, but instead using the internal 600ppm oscillator? If so how do I get the CC2340 to use the external oscillator?
You have found the correct location for setting the desired LF clock source in SysConfig, and the CC2340 LFCLK should be referencing the low frequency crystal oscillator accordingly. You can check the values of LFCLKSEL and LFCLKSTAT during run-time to confirm. Please compare your custom hardware findings against a TI LaunchPad, and keep in mind that external crystals also have a ppm accuracy (ex. +/- 380 ppm on the LaunchPad external crystal), which could be further exacerbated by improper LF crystal tuning. You can also evaluate the TIME8U value and keep in mind that these registers are 32-it unsigned integer representations. Ultimately, seconds drift over hours of time can be expected. Here is a useful App Report: https://www.ti.com/lit/swra495
Regards,
Ryan
I confirmed my LFCLKSEL and LFCLKSTAT,It seems that the switch to the external oscillator was successful.
I also used an instrument to measure and confirm that the error value is +12ppm.
If the RTC long-term inaccuracy is insufficient for your needs, you could consider using an external coin-cell RTC IC connected to the CC2340R5. Another option is to append time values from your central device (such as a smartphone clock) to update the peripheral time.
Regards,
Ryan
Hi, Ryan
But I don’t think this is a solution to the fundamental problem. The load capacitance I used is within the specified range (6pF~12pF), and I also asked you about the configuration of Syscfg. The configuration is also correct, and I also used the ability to measure The oscillator accuracy was measured with an instrument and the error value was only +12ppm, but the result from the RTC was 2 seconds slower. Should we look for why the configuration is correct but the ideal result cannot be achieved?
Please compare your custom hardware findings against a TI LaunchPad
Also test with a non-BLE, empty TI Driver example with RTC added and consider testing with standby power mode blocked (i.e. operate in active only).
Regards,
Ryan
I used TI LaunchPad for two hours of testing and found that the RTC would be 2 seconds slower, which was indeed within the range of +-380ppm, but strangely I checked the BOM of TI LaunchPad and found that its oscillator should be +-20ppm, 380ppm seems to be generated when the operating temperature is exceeded?
Thanks for the quick investigation and response. How are you measuring the RTC on your LaunchPad over a specific period of time? The preference is that you are outputting via communication peripheral such as UART and not relying on an active JTAG connection and CCS debugger session, which could affect timing.
Regards,
Ryan
(1)I use LP-XDS110ET to connect CC2340 , then entered the Debug mode and recorded the value of the RTC524M at the beginning of the measurement, and then read the value of the RTC524M after 2 hours, and then subtracted the value at the beginning of the measurement to convert the elapsed time.
And 380ppm * 60(sec) * 60(min) * 2 is also about 2 seconds, so the result of this measurement should be accurate?
(2)I have a question: Is the RTC error value of TI LaunchPad definitely 380ppm? Because one of the items written in the above-mentioned oscillator specification is "Frequency make tolerance". Does this mean that in addition to 380ppm, there is also +-20ppms?
1) Please measure RTC524M without connecting a debugger.
2) Here is the Datasheet of the 32 kHz crystal used by the TI 2340R5 LaunchPad. The Frequency Stability over Operating Temperature is 380 ppm and the Frequency Make Tolerance is +/- 20 ppm @ 25 C +/- 3 C. You can contact the crystal manufacturer for more information.
The time offset is likely caused by the sampling method, not the crystal stability.
Regards,
Ryan
First of all, the testing process described at the beginning of the article did not use Debug, so I think it does not matter whether to enter Debug mode or not. After testing again, I think the RTC524M scratchpad does not mean that each Count will be exactly 0.524 (seconds). because
(1)524(ms) is not divisible by the 32.768K oscillator
(2) I found that 524.2919921875 (ms) is divisible by the 32.768K oscillator. Now, after getting the scratchpad value, each count is multiplied by 524 (milliseconds). If the error of each Count is 0.2919921875 (ms), then an error of 2 seconds in 1 hour is indeed possible.
(3) 524(ms) I guess it is calculated using a 32K oscillator, because 524(ms) can be evenly divided by 32K
If my speculation above is correct, then what is the correct and accurate time for each count of the RTC524M register?
In addition, I would like to ask if the RTC of CC2340 has interrupts that can be used? If so, how should I use the RTC interrupts?
I understand your concerns and have asked asked the System Developers about the discrepancy you raised. From what has been fed back to me so far:
The way I interpret the TRM and what I’ve been provided to date implies that the LSB for the RTC.TIME8U represents precisely 8us which means the LSB for RTC.TIME524M would have to represent 524.288ms, not 524ms in order to be consistent. Which means we should probably at least update the description of the register in the chapter in the TRM.
Thus multiplying with a more precise value (0.524288) could likely increase your accuracy.
Concerning interrupts, they can be used and are covered by Sections 12.3 and 12.4 of the TRM. For example, using the RTC.CH0CC8U compare value to trigger a channel 0 interrupt event when TIME8U.VAL exceeds this value. You can also consider using SYSTIM to accomplish similar requirements, given that it synchronizes with the RTC.
Regards,
Ryan
Hi Ryan,
(1) Does RTC confirm that the accuracy is 524.288(ms)? Because I did calculate 524.288(ms) at the beginning when testing, because 524.288(ms) / 32.768K = 16, but later we found that 32.768K is the oscillator period, that is, it will oscillate 32,768 times in 1 second, so if 524.288 (ms) is converted to oscillation 17,179.869184 times, it is a bit unreasonable, because the number of oscillations of the oscillator should not have a decimal point, so I thought in the previous message It is 524.2919921875(ms), because 524.2919921875(ms) * 32768 = 17180, we think it is more reasonable. Can you please confirm with the development department whether it is 524.288(ms) or 524.2919921875(ms)?
(2)The SYSTIM you mentioned, I did see relevant information in "TRM", but there is no actual operation example, and I checked the TI E2E forum and there is no information about how to call or apply SYSTIM. Can you please Give me more detailed guidance?
(1) The System Development Team has confirmed that TIME524M returns TIME[50:19], where the bit index 0 here has the significance 1 us, and thus the LSB of TIME524M has significance 2^19 us = 524.288 ms.
(2) There is a systimtimestamp example available which primarily uses the SYSTIM channel capture functionality. There is no Driverlib or TI Driver library available for SYSTIM at the moment, thus you would need to develop by accessing the SYSTIM registers directly.
Regards,
Ryan
(1)It means that bit index 0 to index 18 are the units of the RTC524M temporary register, so it is 2^19 = 524.288, and then bit index 19 to index 50 are the values of RTC524M in Count. Can I understand it this way?
Bit indexes 0 through 18 are further granularity of the RTC count. For example, TIME8U returns TIME[34:3] (i.e. 2^3 us = 8 us).
Regards,
Ryan
OK , thanks . The current test results are accurate. I will conduct long-term testing. If I find any problems again, I will discuss them on the forum.
I also have a question, how does the development department determine LSB = 1us, because if calculated based on the cycle of 1(s) / 32.768(k), it should be about 30us. So how is 1us calculated?
"The RTC maintains a “time accumulator” with width TIME[50:-16]. Bit index 0 here has the significance 1 us, so TIME has a range of 2^51*(1 us) = 71.4 years and a precision (not accuracy) of 2^-16*(1 us) = 15.3 ps."
I believe efforts are underway to update the TRM to highlight the fact that "the RTC accumulates time with a precision of 15.3 ps (based on LFINC – the provided/estimated CLKLF period) rather than just counting the number of CLKLF periods (as most other RTCs)."
Regards,
Ryan