The RTC Time Seconds Register (TSR) and Timer Prescaler Register (TPR) do not increment while the K65 is running/single stepping (nor powered off with a battery connected).
The tower does not have this problem. Both TSR and TPR run (constantly increment) and when powered off/on the TSR is updated to reflect the elapsed time.
Furthermore, the KSDK example rtc_example_twrk65f180m sets an RTC alarm and waits for it to happen. This works on the tower and not on our board.
I'm thinking there is some K65 errata that Freescale/NXP don't know about yet.
Could this be related to MCG clock speed?
Has anybody seen this problem or does anyone have any idea how to fix it?
Solved! Go to Solution.
Hi Mark
Check your 32kHz crystal on your own HW - without this oscillating the time will never increment (as in your case).
If this is not the cause, check that the RTC oscillator intialisation has not been missed somehow; ie. setting RTC_CR_OSCE bit in RTC_CR.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html
I had the same problem with a custom K81 board. The RTC did not run with any new MCUXpresso project. But it did run with some example code. On investigation I found that the watchdog setup in the demo checked and set the RTC CR OSCE bit, because it needed the RTC Time Alarm. The side-effect was that the RTC ran beautifully... until I disabled the watchdog. To preserve sanity I set the OSCE bit right after the RTC_Init
rtc_config_t rtcConfig; RTC_GetDefaultConfig(&rtcConfig); RTC_Init(RTC, &rtcConfig); RTC->CR |= RTC_CR_OSCE_MASK; // Enable Oscillator RTC_StartTimer(RTC);
Hi Mark
Check your 32kHz crystal on your own HW - without this oscillating the time will never increment (as in your case).
If this is not the cause, check that the RTC oscillator intialisation has not been missed somehow; ie. setting RTC_CR_OSCE bit in RTC_CR.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html
That's what was wrong. The RTC oscillator was not running. Thanks Mark!
That’s good info Mark. Thank you!
Thanks
Mark Scovel