Hello,
I am trying to configure RTC in target cortex-M0 KEAZN64 as follows;
SIM_PINSEL |= SIM_PINSEL_RTCPS_MASK; /* To get the toggled pin on PTC5 */
RTC_MOD = 16000; /* Setting MOD value by 16000 */
---------------------------
After debugging, I found out that any write any of RTC registers configuration causes "hardfault" exception (HardFault_Handler)
Any help or advice please ?
Thank you inn advance.
Hi Mohammed Aboelnasr,
As Mark said, you need to enable the clock gate SIM_SCGC[RTC] of RTC module first.
You can direct refer the Lab3_Blinky_RTC_KEA64 example of SDK-DRIVER-FRDM-KEA-S32DS.(...\SDK-DRIVER-FRDM-KEA-S32DS\KEAZ64 Driver testcode and Examples (for S32DS)\KEAZ64_Lab Code Examples\Lab3_Blinky_RTC_KEA64\src)
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Robin,
Thank you for your clarification.
I don't know how I missed this point :smileygrin:
Hi
You need to first enable the clock to the RTC module - see the SIM_SCGC register.
Regards
Mark
Hi Mark,
Thank you for this note. I don't know how I missed the clock gating control !! :smileygrin: