AnsweredAssumed Answered

How to enter Sleep mode(If Possible  deep sleep also) and wake up using LPTMR

Question asked by sachin joy on Jun 6, 2015
Latest reply on Jun 6, 2015 by Mark Butcher

I am Using KL16z64VLH4 with Configuration

 

    SIM_COPC    = 0x00U;                                                                                                  // DISABLE THE WDOG MODULE

    SIM_CLKDIV1 = (SIM_CLKDIV1_OUTDIV1(0x00) | SIM_CLKDIV1_OUTDIV4(0x00));  // SET THE SYSTEM PRESCALERS TO SAFE VALUE --DIVIDE BY 1

    SIM_SOPT2   = 0x0000;                                                                                                // SELECT FLL AS A CLOCK SOURCE FOR VARIOUS PERIPHERALS

    SIM_SOPT2  |= SIM_SOPT2_UART0SRC(3);                                                              // SELECT MCGIRCLK FOR UART0

    SIM_SOPT1  |= SIM_SOPT1_OSC32KSEL(00);                                                         // EXTERNAL CLOCK ---32 KHZ CLOCK SOURCE FOR RTC

    OSC0_CR    |= 1<<7;                                                                                                  // ENABLES THE OSC CLOCK

    MCG_SC      = 0X00;                                                                                                   // FRCDIV=1

    MCG_C1      = 0X46;                                                                                                 // SELECT INTERNAL REFERENCE CLOCK

    MCG_C2      = 0X01;                                                                                                   // FAST INTERNAL REFERENCE CLOCK IS SELECTED

 

and LPTMR Config

as

 

SIM_SCGC5 |= SIM_SCGC5_LPTMR_MASK;                                                  

  LPTMR0_CSR = 0x00U;    

  LPTMR0_CMR = 0x00U;

  LPTMR0_CMR = LPTMR_CMR_COMPARE(cmp_value);                                                  

  LPTMR0_CSR = LPTMR_CSR_TCF_MASK;                                                  

  LPTMR0_PSR = LPTMR_PSR_PRESCALE(13);                                                  

  NVIC_ISER |= (1 << ((uint32_t)(INT_LPTimer -16) & 0x1F));     // ENABLING THE INTERRUPT

  NVIC_ICPR |= (1 << ((uint32_t)(INT_LPTimer -16) & 0x1F));

   NVIC_IPR7 = 6; 

  LPTMR0_CSR |= LPTMR_CSR_TIE_MASK;

  LPTMR0_CSR |= LPTMR_CSR_TEN_MASK;

 

Can any body sugget me a sleep mode and its configuration,

Outcomes