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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

219 Views
sachinjoy
Contributor I

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,

0 Kudos
1 Reply

50 Views
mjbcswitzerland
Specialist V

Hello

You may find something of interest at µTasker LLWU Support

Regards

Mark

Kinetis: µTasker Kinetis support

K20: µTasker Kinetis TWR-K20D72M support  / µTasker Kinetis FRDM-K20D50M support  / µTasker Kinetis TWR-K20D50M support  / µTasker Teensy3.1 support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos