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.

RTOS/CC1310: Pinshutdown problem

Part Number: CC1310


Tool/software: TI-RTOS

Hi Team,

I am using the pinshutdown feature, but I have encountered some problems.My goal is to get the shutdown state of the device into shutdown, then use a rising edge of the pin to wake up the device and use the falling edge to put it back into the shutdown state when needed. The problem now is that I can't wake up the device. Here is my code. Please see if there is a problem?

/* Wake-up Button pin table */
PIN_Config ButtonTableWakeUp[] = {
    Board_PIN_BUTTON1     | PIN_INPUT_EN | PIN_PULLUP | PINCC26XX_WAKEUP_NEGEDGE,
    PIN_TERMINATE                                 /* Terminate list */
};

/* Shutdown Button pin table */
PIN_Config ButtonTableShutdown[] = {
    Board_PIN_BUTTON1   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_POSEDGE,
    PIN_TERMINATE                                 /* Terminate list */
};

int main(void)
{
    
    /* Get the reason for reset.
     * On CC26X2, SysCtrlResetSourceGet() must be called before
     * PIN_init() because unlatching the IOs will clear the
     * wakeup from shutdown bit.
    */
    uint32_t rSrc = SysCtrlResetSourceGet();
    
    /* Call driver init functions. */
    Board_initGeneral();
    
    /* Open LED pins */
    ledPinHandle = PIN_open(&ledPinState, pinTable);
    Assert_isTrue(ledPinHandle != NULL, NULL);
    
    /* If coming from shutdown, use special gpio table.*/
    if (rSrc == RSTSRC_WAKEUP_FROM_SHUTDOWN) {     
        
        isWakingFromShutdown = true;
        
         /* Setup button pins with ISR */
        hButtons = PIN_open(&buttonState, ButtonTableShutdown);
        PIN_registerIntCb(hButtons, buttonCb);
        
    } else {
        /* When not waking from shutdown, use default init table. */
        isWakingFromShutdown = false;
        
        /* Configure DIO for wake up from shutdown */
        PINCC26XX_setWakeup(ButtonTableWakeUp);
        
        /* Go to shutdown */
        Power_shutdown(0, 0); 
    }
            
    /* Initialize task */
    shutdownTaskInit();
    txTaskInit();
    uartTaskInit();
    
    /* Start BIOS */
    BIOS_start();
    
    return (0);
}

static void shutdowntaskFxn(UArg a0, UArg a1)
{
    /* If we are waking up from shutdown, we do something extra. */
    if (isWakingFromShutdown) {
        /* In this example we toggle LED1 */
       UART_write(uart,"wake",4);
    }
    else
    {
      UART_write(uart,"reset",5);
    }
    
    /* Should never get here, since shutdown will reset. */
    while (1)
    {
      /* Pend on semaphore before going to shutdown */
      Semaphore_pend(Semaphore_handle(&shutdownSem), BIOS_WAIT_FOREVER);
    
      /* Configure DIO for wake up from shutdown */
      PINCC26XX_setWakeup(ButtonTableWakeUp);
      UART_write(uart,"shutdown",8);
    
      /* Go to shutdown */
      Power_shutdown(0, 0);
    };
}