Alice,
Those links were of help to me.
I sort of fixed the problem and but sort of not fixed the problem as well. :smileyhappy:
I have the RTC osc enabled as you could see and the hardfault error is coming right when it hits the if condition(below in bold)
#ifdef CLOCK_SETUP
if((RCM->SRS0 & RCM_SRS0_WAKEUP_MASK) != 0x00U)
{
if((PMC->REGSC & PMC_REGSC_ACKISO_MASK) != 0x00U)
{
PMC->REGSC |= PMC_REGSC_ACKISO_MASK; /* Release hold with ACKISO: Only has an effect if recovering from VLLSx.*/
}
} else {
#ifdef SYSTEM_RTC_CR_VALUE
SIM_SCGC6 |= SIM_SCGC6_RTC_MASK;
if ((RTC_CR & RTC_CR_OSCE_MASK) == 0x00U) { /* Only if the OSCILLATOR is not already enabled */
RTC_CR = (uint32_t)((RTC_CR & (uint32_t)~(uint32_t)(RTC_CR_SC2P_MASK | RTC_CR_SC4P_MASK | RTC_CR_SC8P_MASK | RTC_CR_SC16P_MASK)) | (uint32_t)SYSTEM_RTC_CR_VALUE);
RTC_CR |= (uint32_t)RTC_CR_OSCE_MASK;
RTC_CR &= (uint32_t)~(uint32_t)RTC_CR_CLKO_MASK;
}
#endif
According to me everything is fine on the hardware side. I am able to run the same configuration on the other hardware with almost same configuration.
Can you direct to understand how exactly the RTC works of there is something missing?