Hi Support,
I'm trying to write a simple example where my device goes into LPDS, wakes, and then hibernates. However, I'm having trouble getting my custom hardware to hibernate after it enters LPDS.
When I remove the Power_enablePolicy() call, the hibernation functionality works as expected (without LPDS).
Any ideas about what might be happening here?
I'm using SDK 2.40.
Thanks,
Brian
// main.c void mainThread(void *pvParameters) { int32_t status = 0; pthread_t spawn_thread = (pthread_t)NULL; struct timespec ts = {0}; pthread_attr_t pAttrs_spawn; struct sched_param priParam; long sysResetCause; long lpdsWakeupCause; uint32_t constraints; /* initialize the realtime clock */ clock_settime(CLOCK_REALTIME, &ts); /* Create a thread for and start the SimpleLink Host */ pthread_attr_init(&pAttrs_spawn); priParam.sched_priority = 9; status = pthread_attr_setschedparam(&pAttrs_spawn, &priParam); status |= pthread_attr_setstacksize(&pAttrs_spawn, SL_TASKSTACKSIZE); status |= pthread_create(&spawn_thread, &pAttrs_spawn, sl_Task, NULL); if (status < 0) powerShutdown(20 * 1000L); // 20 seconds GPIO_init(); SPI_init(); InitTerm(); I2C_init(); UART_PRINT("\r\nStart."); sysResetCause = PRCMSysResetCauseGet(); lpdsWakeupCause = PRCMLPDSWakeupCauseGet(); UART_PRINT("\r\nReset = 0x%x; LPDS Wakeup = 0x%x", sysResetCause, lpdsWakeupCause); sleep(2); Power_enablePolicy(); // Hibernate functions correctly without this line UART_PRINT("\r\nSleep #1..."); sleep(2); sysResetCause = PRCMSysResetCauseGet(); lpdsWakeupCause = PRCMLPDSWakeupCauseGet(); UART_PRINT("\r\nReset = 0x%x; LPDS Wakeup = 0x%x", sysResetCause, lpdsWakeupCause); UART_PRINT("\r\nDone."); Power_disablePolicy(); sleep(3); UART_PRINT("\r\nHibernate."); constraints = Power_getConstraintMask(); UART_PRINT("\r\nConstraints = 0x%x", constraints); status = Power_getTransitionState(); UART_PRINT("\r\nTransition State = %d", status); status = powerShutdown(10 * 1000L); // 10 seconds UART_PRINT("\r\nHibernate Status = %d", status); status = Power_getTransitionState(); UART_PRINT("\r\nTransition State = %d", status); UART_PRINT("\r\nSTOP: I shouldn't see this message."); } extern void WiFi_enterLPDSHookFxn() { UART_PRINT("\r\n>> WiFi_enterLPDSHookFxn"); } extern void WiFi_resumeLPDSHookFxn() { InitTerm(); UART_PRINT("\r\n>> WiFi_resumeLPDSHookFxn"); }
// CC3220S_LAUNCHXL.c const PowerCC32XX_ConfigV1 PowerCC32XX_config = { .policyInitFxn = &PowerCC32XX_initPolicy, .policyFxn = &PowerCC32XX_sleepPolicy, .enterLPDSHookFxn = &WiFi_enterLPDSHookFxn, .resumeLPDSHookFxn = &WiFi_resumeLPDSHookFxn, .enablePolicy = false, .enableGPIOWakeupLPDS = true, .enableGPIOWakeupShutdown = true, .enableNetworkWakeupLPDS = true, .wakeupGPIOSourceLPDS = PRCM_LPDS_GPIO2, // UART RX .wakeupGPIOTypeLPDS = PRCM_LPDS_RISE_EDGE, .wakeupGPIOFxnLPDS = NULL, .wakeupGPIOFxnLPDSArg = 0, .wakeupGPIOSourceShutdown = PRCM_HIB_GPIO4, // push button .wakeupGPIOTypeShutdown = PRCM_HIB_RISE_EDGE, .ramRetentionMaskLPDS = PRCM_SRAM_COL_1 | PRCM_SRAM_COL_2 | PRCM_SRAM_COL_3 | PRCM_SRAM_COL_4, .keepDebugActiveDuringLPDS = false, .ioRetentionShutdown = PRCM_IO_RET_GRP_1, .pinParkDefs = parkInfo, .numPins = sizeof(parkInfo) / sizeof(PowerCC32XX_ParkInfo) };
Failing to hibernate:
Start. Reset = 0x1; LPDS Wakeup = 0x1 // LPDS woken from PRCM_LPDS_TIMER Sleep #1... Reset = 0x1; LPDS Wakeup = 0x1 Done. Hibernate. Constraints = 0x0 Transition State = 2 // Power_ENTERING_SLEEP Hibernate Status = -5 // Power_EBUSY Transition State = 1 // Power_ACTIVE STOP: I shouldn't see this message. Start. Reset = 0x5; LPDS Wakeup = 0x0 // 16-second watchdog (PRCM_WDT_RESET) Sleep #1... >> WiFi_enterLPDSHookFxn Start. Reset = 0x1; LPDS Wakeup = 0x1 Sleep #1... Reset = 0x1; LPDS Wakeup = 0x1 Done. Hibernate. Constraints = 0x0 Transition State = 2 Hibernate Status = -5 Transition State = 1 STOP: I shouldn't see this message. Start. Reset = 0x5; LPDS Wakeup = 0x0 Sleep #1... >> WiFi_enterLPDSHookFxn Start.
Hibernating correctly, without Power_enablePolicy() call:
Sleep #1... Reset = 0x0; LPDS Wakeup = 0x0 Done. Hibernate. Constraints = 0x0 Transition State = 1 Start. Reset = 0x7; LPDS Wakeup = 0x0 // Hibernate successfully (PRCM_HIB_EXIT) Sleep #1... Reset = 0x7; LPDS Wakeup = 0x0 Done. Hibernate. Constraints = 0x0 Transition State = 1 Start. Reset = 0x7; LPDS Wakeup = 0x0