[KEAZN64] Configuring RTC always causing "HardFault" exception

cancel
Showing results for 
Search instead for 
Did you mean: 

[KEAZN64] Configuring RTC always causing "HardFault" exception

290 Views
mohammedaboelna
Contributor III

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.

4 Replies

148 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Mohammed Aboelnasr,

As Mark said, you need to enable the clock gate SIM_SCGC[RTC] of RTC module first.

SIM_SCGC[RTC].png

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!
-----------------------------------------------------------------------------------------------------------------------

148 Views
mohammedaboelna
Contributor III

Hi Robin,

Thank you for your clarification.

I don't know how I missed this point :smileygrin:

0 Kudos

148 Views
mjbcswitzerland
Specialist V

Hi

You need to first enable the clock to the RTC module - see the SIM_SCGC register.

Regards

Mark

http://www.utasker.com/services.html

148 Views
mohammedaboelna
Contributor III

Hi Mark,

Thank you for this note. I don't know how I missed the clock gating control !! :smileygrin:

0 Kudos