AnsweredAssumed Answered

how to put contoller in stop mode for 15min with lptimer?

Question asked by Reena Patel on Jun 12, 2019
Latest reply on Jun 13, 2019 by Kerry Zhou

Hello all,

i am using mk20dxvll7 micro-controller for my project. and i want to put it on stop mode after data posting through GSM and wakeup through lptimer. and i want to put my microcontroller in stop mode for 15min.

From demo code i am able to put contoller in stop mode for 1 min. but not able for 15min.

here is the sequence which i follow in code.

 

SIM_SCGC5 |= SIM_SCGC5_LPTIMER_MASK; /// Init Clock of LPTIMER.

LPTMR0_CSR = (LPTMR_CSR_TCF_MASK | LPTMR_CSR_TPS(0x00)); /* Clear control register */

LPTMR0_CMR =0xFFFE; /* Compare. */

LPTMR0_PSR = LPTMR_PSR_PRESCALE(0x00) | LPTMR_PSR_PBYP_MASK | LPTMR_PSR_PCS(0x01); /* Set up prescaler register */

LPTMR0_CSR = ( LPTMR_CSR_TPS(0x00) | LPTMR_CSR_TFC_MASK | LPTMR_CSR_TIE_MASK | LPTMR_CSR_TEN_MASK); /* Set up control register */

enable_irq(INT_LPTimer-16);

 

SIM_SCGC4 |= (uint32_t) SIM_SCGC4_LLWU_MASK;
/* Initialization of the LLWU module */
LLWU_PE1 = 0x00;
LLWU_PE2 = 0x00;
LLWU_PE3 = 0x00;
LLWU_PE4 = 0x00;
LLWU_ME = 0x00;

/* LLWU_FILT1: FILTF=1,FILTE=0,??=0,FILTSEL=0 */
LLWU_FILT1 = LLWU_FILT1_FILTF_MASK | LLWU_FILT1_FILTE(0x00) | LLWU_FILT1_FILTSEL(0x00);
LLWU_FILT2 = LLWU_FILT2_FILTF_MASK | LLWU_FILT2_FILTE(0x00) | LLWU_FILT2_FILTSEL(0x00);
LLWU_RST = LLWU_RST_LLRSTE_MASK | LLWU_RST_RSTFILT_MASK;
LLWU_ME |= (uint8_t) ( LLWU_ME_WUME0_MASK); /// -> Module LPTMR0

SMC_PMPROT = SMC_PMPROT_AVLLS_MASK;

 

/* Set the VLLSM field to 0b100 for VLLS1 mode - Need to retain state of LPWUI bit 8 */
SMC_PMCTRL = SMC_PMCTRL_STOPM(0x4) ;
SMC_PMCTRL |= SMC_PMCTRL_LPWUI_MASK; //reena
SMC_VLLSCTRL = SMC_VLLSCTRL_VLLSM(1);

stop();

 

Please check this sequnce. and let me know what should i do to put stop mode continuous for 15min.

Please reply as soon as possible.

Thanks and regards 

Reena

Outcomes