KS22XXX RTC REGISTER FAULT

cancel
Showing results for 
Search instead for 
Did you mean: 

KS22XXX RTC REGISTER FAULT

290 Views
召宝田
Contributor I

Hi,

Now I'm working on KS22xxxx. There is a problem that when I was initializing the RTC module through writing or reading the register of it, the processor would report a HARDWARE FAULT. I'm wondering what I have done have any issues.

Following is my code.

rtc_datetime_t mrtc_datetime_t;

rtc_config_t mrtc_config_t;

memset(&mrtc_datetime_t,0,sizeof(rtc_datetime_t));

RTC_GetDefaultConfig(&mrtc_config);

RTC_Init(RTC,&mrtc_config_t);

RTC_StartTimer(RTC);

0 Kudos
1 Reply

122 Views
mjbcswitzerland
Specialist V

Hi

Before accessing RTC register you need to enable the RTC clock kin SIM_SCGC6. If not, you will have a hard fault.

In addition, VBAT needs to be connected!

Regards

Mark

0 Kudos