Hi all,
I am working on FRDM-K20D50M and FRDM-KL25Z boards.
Also I would like to use RTC to make MCU woken up from the low power mode.
In the FRDM-K20D50M case, it seems to be no problem.
However, in the FRDM-KL25Z case, the MCU hangs up when RTC_CR[OSCE] bit is set.
I think the reason would be because no 32kHz OSC was not equipped on the FRDM-KL25Z board,
For your reference, I will show my code below.
void RTC_init(void)
{
SIM_SCGC6 |= SIM_SCGC6_RTC_MASK;// by this statement, hard fault becomes not occur
RTC_CR |= RTC_CR_OSCE_MASK; //<= hanged up at this statement
RTC_TPR = 0;
RTC_TSR = 0xFFFFFFFF-5;
RTC_TAR = 0;
while((RTC_SR &( RTC_SR_TOF_MASK|RTC_SR_TIF_MASK))!=0);
RTC_SR |= RTC_SR_TCE_MASK; //<= although enabled RTC, count does not count up
}
If 'RTC_CR |= RTC_CR_OSCE_MASK' does not exist, the hanged-up does not occur.
However the overflow interrupt neither occur.
Could anyone let me know how to use RTC on FRDM-KL25Z board?
Otherwise, can RTC not actually be used on FRDM-KL25Z board?
Best regards,
Yasuhiko Koumoto.