Using LPTMR to Wake Up from Stop/LLS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using LPTMR to Wake Up from Stop/LLS

Jump to solution
1,653 Views
justinsayres
Contributor II

Hi,

 

I am new to using low power modes and I have spent a bit of time reading all the documentation and forum discussions without success.

 

I just want to use the LPTMR to trigger entering RUN mode.  It seems like the LPTMR interrupt flag is not triggering the LLWU to wakeup.  I added another wakeup source, external pushbutton, and that triggers the LLWU just fine.  So I'm not sure what I'm doing wrong with the LPTMR.  I do notice that most examples of using PE to generate the code use the TimerInt component along with a timer unit.  I tried to do that but when I enabled everything, I couldnt get access to certain commands such as RESET and UpdateTicks.  When I only use the Timer Unit LDD, it generates and interrupt so I don't really understand why  the interrupt component is even needed.

 

This is the code for the interrupt handling:

void Cpu_OnLLSWakeUpINT(void) {   /* Write your code here ... */   uint32_t tmp;      tmp = Cpu_GetLLSWakeUpFlags();    if (tmp & LLWU_INT_MODULE0) /* LPTMR */   {      LPTMR0_CSR |=  LPTMR_CSR_TCF_MASK;   // write 1 to TCF to clear the LPT timer compare flag     }   else if( tmp & LLWU_INT_MODULE0) /* WakeUp Button - PTC6 */   {   LLWU_PE3 |= LLWU_PE3_WUPE10_MASK;   }   HEARTBEAT_LED_SetVal(HEARTBEAT_LED_DeviceData); }     void mSecTimer_OnCounterRestart(LDD_TUserData *UserDataPtr) {   /* Write your code here ... */   if(sensorMode == STANDBY) // if the sample interval just elapsed and we need to start a new sample   {     totalSampleTime += samplingInterval; // update totalSampleTime     startNewSample = TRUE; //  Set Flag   }   else   {     if(measurementStatus != COMPLETE) //  if we are in the middle of a measurement     {       totalSampleTime += measurementTime;       measSpecPressDone = !measSpecPressDone;       measurementStatus = COMPLETE;     }   } }

 

 

And this is where I call the PE CPU_SetOperationMode:

  if (LP_mode==LP_WAIT)    {        Cpu_SetOperationMode(DOM_WAIT, NULL, NULL); /* next interrupt will wake us up */   } else if (LP_mode==LP_SLEEP)    {        Cpu_SetOperationMode(DOM_SLEEP, NULL, NULL); /* next interrupt will wake us up */   } else if (LP_mode==LP_STOP)    {        Cpu_SetOperationMode(DOM_STOP, NULL, NULL); /* next interrupt will wake us up */   }

 

It is basically Erich Styger's code that I got from his mcuoneclipse website.  Like I said the only real difference I can see is my PE setup.

 

If anyone can shed some light I would really appreciate it.

Original Attachment has been moved to: My_PE_Setup.pef.zip

Labels (1)
0 Kudos
1 Solution
773 Views
justinsayres
Contributor II

I solved the problem.  I did not have system oscillator setting correct.  I attached the working PE settings.

View solution in original post

0 Kudos
1 Reply
774 Views
justinsayres
Contributor II

I solved the problem.  I did not have system oscillator setting correct.  I attached the working PE settings.

0 Kudos