AnsweredAssumed Answered

K64F RTC Hard fault during initialization

Question asked by Priyank Bhatt on Dec 16, 2017
Latest reply on Jun 11, 2018 by Priyank Bhatt

 Hi, I am using MK64FN1M0VLL12 processor and working on RTC. But in the first line itself getting a hard fault. I tried to solve it but failed. can anyone help to solve this problem. External 32.768KHz crystal, Battery connected. Open to any suggestion.

This my initialization code. Thank you.

 

void rtc_init(void)

{

   volatile uint32_t i;

   SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;

   RTC->SR &= ~RTC_SR_TCE_MASK;

   RTC->CR &= ~RTC_CR_OSCE_MASK;

   RTC->CR |= RTC_CR_OSCE_MASK;

   for(i=0;i<0x60000;i++)

   { }

   RTC->SR |= RTC_SR_TCE_MASK;

}

Outcomes