Hi there,
Is there anybody know where I can find some example code for NXP KL82 processor running in low power mode on RTX?
I already have a working project setup by colleague. but there is no os_idle_thread implemented. I searched on internet and get some clue on how to do it. I know I have to setup a lptmr, llwu, and then put the mcu into lls mode. I saw an example code write for TI's msp430 chip. I did some modification it seems not working properly.
here is my code
void os_idle_demon (void) { for (;;) { tc_weakup = os_suspend(); if (tc_weakup > 0) { tc = 0; lp_sleep = 1; /* Do not wake up on exit from ISR */ SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk; /* Setting the sleep deep bit */ SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk); __WFI(); } os_resume(tc); } } void systime_tick() { if (tc++ > tc_weakup && lp_sleep) { lp_sleep = 0; scb->scr &= ~scb_scr_sleeponexit_msk; return; } ++systime_ms; }
any insight would be grateful. thank you
I feel after the rtx initialized, my code never blocked and enter to os_idle_deamon. Does os_delay put the thread into wait state and block the code?
I forgot to write "SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeLls);" to enable lls mode. And seems you cannot stop while debugging? the PMSTAT is always 1 no matter how I se PMPROT, PMCTRL and STOPCTRL.
But it entered into sleep mode, if I just reset my board. The current reading from my power supplier is 0ma. Have to see if my os_deamon_idlea implementation work tomorrow.