Reset when trying to start RTC oscillator

cancel
Showing results for 
Search instead for 
Did you mean: 

Reset when trying to start RTC oscillator

276 Views
abbian
Contributor II

Hi

I'm using a K12 micro and want to use an external crystal on EXTAL32/XTAL32 as the source for the FLL and RTC.  When I try to start the RTC oscillator using the following code I get a reboot at line 3.

1. SIM_SCGC6 = SIM_SCGC6_RTC_MASK;

2. RTC_CR  = RTC_CR_SWR_MASK + RTC_CR_SC4P_MASK + RTC_CR_SC8P_MASK + RTC_CR_CLKO_MASK;

3. RTC_CR  &= ~RTC_CR_SWR_MASK;

4.  RTC_CR |= RTC_CR_OSCE_MASK;

I read on this forum that VBAT left floating can cause this.  This is how my design is implemented.  Could there be another issue causing the reset?  If this is the cause, is there a workaround?

Thanks,

Dan

Labels (2)
Tags (1)
0 Kudos
1 Reply

126 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Dan Rhodes:

The RTC is powered from VBAT pin, which is a different power domain from the MCU VDD power. It is normal that there is a hardfault when accessing the RTC registers if there is no VBAT power. There is no workaround, this is how it is designed.

If you are not interested in the RTC working during power outage, you can simply hang the VBAT pin to VDD.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------