I have developed battery operated IoT product but am unable set my application to the lowest power mode. This is the code I am using in a FreeRTOS task to set to sleep mode:
// Enter LLS3 STOP mode
lls_config.subMode = kSMC_StopSub3;
lls_config.enableLpoClock = true;
SMC_PreEnterStopModes();
if(SMC_SetPowerModeLls(SMC, &lls_config) != kStatus_Success)
PRINTF("FAIL SMC_SetPowerModeLls FAIL!!!\n\r");
SMC_PostExitStopModes();
BTW, I am running my application in FEI mode by default. Let me know if it is possible to enter into deep low power mode in this state. Let me know if you need further info.
UPDATE: I got it to get out of low power mode after disabling low power tickless mode.
#define configUSE_PREEMPTION 1
#define configUSE_TICKLESS_IDLE 0
#define configCPU_CLOCK_HZ (SystemCoreClock)
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES 5 // lower number -> lower priority
#define configMINIMAL_STACK_SIZE ((unsigned short)256)
#define configMAX_TASK_NAME_LEN 20
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_TASK_NOTIFICATIONS 1
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
#define configQUEUE_REGISTRY_SIZE 8
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 1
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 0
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1
by setting configUSE_TICKLESS_IDLE from 2 to 0.
Update: Now I am able to enter LLS3 mode (after de-initializing the QSPI). Now the problem is, it seems to be stuck in LLS3 mode, is there more steps to take to return back to FEI running mode? For some reason, the debugger gets disconnected after waking up from low power mode so hard to see where the issue is.