This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220SF: Crash when waking up from LPDS mode triggered by GPIO

Part Number: CC3220SF

Hi,

    I follow the following post to enable GPIO waking up from LPDS mode based on AWS demo project and test in LaunchPad board.

 https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/p/702783/2592071#2592071

    By observing an UART output message, I can detect the state of my code. The result is it can get into LPDS mode. However once the SW2 is pressed, the code stop or crash.  

while(true)
{
    UART_read(xtUartHndl, &cChar, 1);
    uartSendCmd('A');
    vTaskDelay(pdMS_TO_TICKS( 1000 ));
}

    The wakeup callback function. No LED toggle or UART message is observed.

void gpioButtonFxn1(uint_least8_t index)
{
    GPIO_toggle(GPIOCC32XX_GPIO_10);
    uartSendCmd('A');
    while(1);

}

        

    Please help. Thanks.

  • Hi Martin,

    Please remove any while loop or timed driver actions from an interrupt callback. GPIO_toggle should be fine, but uartSendCmd takes a long time. A while loop can disrupt the RTOS scheduler. I suggest adding a semaphore or message queue in the button callback and then implement that uartSendCmd in another thread.

    Best regards,

    Sarah

  • Hi Sarah,

        The LED still can't be toggled after removing the while loop and uartSendCmd.  Any further suggestion ? Thanks.

    void gpioButtonFxn1(uint_least8_t index)
    {
        GPIO_toggle(GPIOCC32XX_GPIO_10);

    }

  • Hi Sarah,

        I have added message queue and  the test result is the same as before. The code stop execution once SW2 is pressed.

        Could you verify the LPDS GPIO wakeup function in AWS demo project ? Maybe there is a bug in low level drivers which is difficult for me to verify. Thanks.

    receiving task :

    if( xQueueReceive( xWakeupQueue, &pcReceivedString, portMAX_DELAY ) == pdPASS )
    {
    IotLogInfo( pcReceivedString );
    vPortFree( ( void * ) pcReceivedString );
    }

    callback :

    void gpioButtonFxn1(uint_least8_t index)
    {
    /* Clear the GPIO interrupt and toggle an LED */
    GPIO_toggle(GPIOCC32XX_GPIO_10);
    xQueueSend( xWakeupQueue, "Wakeup", 0 );

    }

  • Hi Sarah,

       I start a new project with the original AWS demo code. Only following modification was added :

    1.  replace the Demo function with a LED blinking loop :

    // DEMO_RUNNER_RunDemos();
    while(true)
    {
    GPIO_toggle(GPIOCC32XX_GPIO_10);
    vTaskDelay(pdMS_TO_TICKS( 1000 ));
    }

    2. add callback function in CC3220SF_LAUNCHXL.c 

    GPIO_CallbackFxn gpioCallbackFunctions[] = {
    gpioButtonFxn1, /* CC3220SF_LAUNCHXL_GPIO_SW2 */
    gpioButtonFxn1 // NULL /* CC3220SF_LAUNCHXL_GPIO_SW3 */
    };

    3. define callback function

    void gpioButtonFxn1(uint_least8_t index)
    {
    /* Clear the GPIO interrupt and toggle an LED */
    GPIO_toggle(GPIOCC32XX_GPIO_09);
    }

    By pressing SW2 or SW3, I failed to see LED_D7 toggled. Could you tell me is there any further code modification needed ? Thanks.

  • Hi Sarah,

       Please skip my last email. I can get reliable GPIO interrupt  in non LPSD mode now. However, still failed to get LPDS GPIO wakeup.

       Because GPIO13 is also defined in gpioPinConfigs[], should I modify the code in gpioPinConfigs[] for enabling LPDS wakeup ?

       Here is my code based on original AWS demo project :

    1.  replace the Demo function with a LED blinking loop :

    // DEMO_RUNNER_RunDemos();

    Power_enablePolicy();
    PRCMLPDSWakeupSourceEnable(PRCM_LPDS_GPIO);

    while(true)

    {
    GPIO_toggle(GPIOCC32XX_GPIO_10);
    vTaskDelay(pdMS_TO_TICKS( 1000 ));
    }

    2. Modify PowerCC32XX_config :

    const PowerCC32XX_ConfigV1 PowerCC32XX_config = {
    .policyInitFxn = &PowerCC32XX_initPolicy,
    .policyFxn = &PowerCC32XX_sleepPolicy,
    .enterLPDSHookFxn = NULL,
    .resumeLPDSHookFxn = NULL,
    .enablePolicy = false,
    .enableGPIOWakeupLPDS = true,
    .enableGPIOWakeupShutdown = true,
    .enableNetworkWakeupLPDS = true,
    .wakeupGPIOSourceLPDS = PRCM_LPDS_GPIO13,
    .wakeupGPIOTypeLPDS = PRCM_LPDS_FALL_EDGE,
    .wakeupGPIOFxnLPDS = gpioButtonFxn0,
    .wakeupGPIOFxnLPDSArg = 0,
    .wakeupGPIOSourceShutdown = PRCM_HIB_GPIO13,
    .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)
    };

    Martin

  • Hi Sarah,

       I have uploaded more code and test result. Please help and thanks.

    Regards,

    Martin

  • Hello,

       Is there any TI employee can help to review this issue ?

       Our project is pending now because of this issue. Thanks.

    Martin