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.

CC1352R: Standby mode and wake from GPIO

Part Number: CC1352R

Hi,

I would like to be able to put the CC1352R in lowest power mode and have it wake-up by either a GPIO or after a specific time elapsed.

My undestanding is that Power_shutdown() call in CC1352R doesn't support shutdownTime parameter. Is this correct?

So I'm left with ClockP_sleep() which does take the device to standby mode and wakes it after the set time.

The thing is that I can't find a way to make it wake from GPIO when calling ClockP_sleep().

Appreciate any guidance on how to solve this.

Thanks!

  • Hi Jose

    From Shutdown mode it is only possible to wake up on pin interrupt, from standby mode you can wake up from pin interrupt or wake up on RTC.

    The pinShutdown example will show you how to move in and out of shutdown by pressing a button:

    https://dev.ti.com/tirex/explore/node?node=AD2UPG41d.YP16c6cZd5Fg__pTTHBmu__LATEST

    The pinStandby example will cycle the device between active and standby states using sleep():

    https://dev.ti.com/tirex/explore/node?node=ACsTMQ2l6HH1BzJte74tJg__pTTHBmu__LATEST

    BR

    Siri

  • Hi Siri,

    Thanks for pointing those examples. 

    I'm following exactly that.

    Like I've mentioned:

    - I can use the shutdown and wake on pressing a button.

    - I can use the go to standby and wake after N seconds.

    Tried to "mix" both by extending the standby sample by calling the  PINCC26XX_setWakeup() before the ClockP_sleep(). No luck. I can push the button multiple times, but it won't wake. Only after the elapsed time.

    Can you let me what I'm doing wrong or what am I missing?

    Thanks,

     

  • There are no need to use PINCC26XX_setWakeup() or ClockP_sleep().

    If you want the device to enter standby and then you want to wake up after a certain time, or when you get a pin interrupt, you can simply use a semaphore. The code below is the pinStandby example modified to wake up every 3 s or whenever the button is pushed.

    *
     *  ======== pinStandby.c ========
     */
    #include <unistd.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Semaphore.h>
    
    /* Driver Header files */
    #include <ti/drivers/PIN.h>
    
    /* TI-Drivers Configuration */
    #include "ti_drivers_config.h"
    
    #include <ti/devices/DeviceFamily.h>
    #include DeviceFamily_constructPath(driverlib/cpu.h)
    
    static Semaphore_Struct buttonSemaphore;
    static Semaphore_Handle buttonSemaphoreHandle;
    
    /* Led pin table */
    PIN_Config LedPinTable[] =
    {
        CONFIG_PIN_LED_0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
        CONFIG_PIN_LED_1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
        PIN_TERMINATE                                                                         /* Terminate list */
    };
    
    /*
     * Application button pin configuration table:
     *   - Buttons interrupts are configured to trigger on falling edge.
     */
    PIN_Config buttonPinTable[] = {
        CONFIG_PIN_0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
        PIN_TERMINATE
    };
    
    /* Pin interrupt Callback function board buttons configured in the pinTable. */
    void buttonCallbackFunction(PIN_Handle handle, PIN_Id pinId) {
    
    
        CPUdelay((uint32_t)((48000000/3)*0.050f));
        if (!PIN_getInputValue(pinId)) {
    
            Semaphore_post(buttonSemaphoreHandle);
        }
    }
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        PIN_State   pinState;
        PIN_Handle  hPin;
        PIN_Handle buttonPinHandle;
        PIN_State buttonPinState;
    
        uint32_t    currentOutputVal;
    
        /* Initialize button semaphore */
        Semaphore_construct(&buttonSemaphore, 0, NULL);
        buttonSemaphoreHandle = Semaphore_handle(&buttonSemaphore);
    
        buttonPinHandle = PIN_open(&buttonPinState, buttonPinTable);
    
        /* Setup callback for button pins */
        PIN_registerIntCb(buttonPinHandle, &buttonCallbackFunction);
    
        /* Allocate LED pins */
        hPin = PIN_open(&pinState, LedPinTable);
    
        while(1) {
    
            Semaphore_pend(buttonSemaphoreHandle, 300000);
    
            /* Toggle the LEDs, configuring all LEDs at once */
            PIN_setPortOutputValue(hPin, 1);
            CPUdelay((uint32_t)((48000000/3)*0.1f));
            PIN_setPortOutputValue(hPin, 0);
        }
    }
    

    Siri