AnsweredAssumed Answered

Problem delay RTC wakeup

Question asked by Daniele Cortellazzi on Jul 29, 2016
Latest reply on Aug 8, 2016 by colin


Hello,

 

i'm using the KL46 with KDS3.2 and SDK1.3.

I use the rtc to wakeup the micro every 4 minute and 30sec. I use the function RTC_DRV_SetAlarm to set the alarm and i reset the RTC timer to 0, so i have this condition:

  • Actual Time 00.00.00 01/01/1970, Allarm Time 0.4.30 01/01/1970

i read then some sensor and put the micro in VLLS1 with this function:

Peripheral_Disable();
  POWER_SYS_SetWakeupModule(kPowerManagerWakeupModule5, TRUE);
  error = CLOCK_SYS_UpdateConfiguration(2, kClockManagerPolicyAgreement);
  i = CLOCK_SYS_GetCoreClockFreq();
  POWER_SYS_SetMode(2, kPowerManagerPolicyAgreement);

 

the system wake up and in the llwu interrupt i have this:

PMC_REGSC = PMC_REGSC_ACKISO(1);
  PORT_HAL_ClearPortIntFlag(PORTD_BASE_PTR);
  if(POWER_SYS_GetWakeupModuleFlag(kLlwuWakeupModule5)){
  SIM_SCGC6 |= SIM_SCGC6_RTC_MASK;
  RTC_DRV_AlarmIntAction(RTCTimer_IDX);
  impulsi_pioggia=0;
  }

 

then the micro reinit doing this command:

/* Write your local variable definition here */

byte error = 0;




/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

PE_low_level_init();

/*** End of Processor Expert internal initialization.                    ***/




LPTMR_DRV_Start(Timer_1ms_IDX);

Init_UART0(48000, 115200);



#ifdef DEBUG
  debug_printf("////////////////////////////////////////////\r\n");
  debug_printf("////////////////////////////////////////////\r\n");
  RTC_DRV_GetDatetime(RTCTimer_IDX, &DataTime);
  debug_printf("Actual Time %02d.%02d.%02d %02d/%02d/%02d\r\n",
    DataTime.hour, DataTime.minute, DataTime.second, DataTime.day, DataTime.month, DataTime.year);
#endif

 

i read :  Actual Time 00.04.55 01/01/1970 so there are 25 sec of delay ... why this? they are so many...

 

In clock configuration 2 used in the VLLS1 i have set this clock

 

Thanks

Outcomes