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.

LP-EM-CC2340R5: issue on shutdown and wakeup

Part Number: LP-EM-CC2340R5
Other Parts Discussed in Thread: CC2652R7, CC2340R5

Hi Teams,

I would like to run shutdown mode by LEFT botton pressed then wakeup mode by the same LEFT button pressed based on board of LP-EM-CC2340R5 

Due to not found the shutdown example directly so I try to refer based on C:\ti\simplelink_cc13xx_cc26xx_sdk_7_10_01_24\examples\rtos\LP_CC2652R7\drivers\gpioshutdown

Now I got the compilation failures on the followings,

(1) Picture:

(2) The same as above: in text 


**** Build of configuration Debug for project gpiointerrupt_LP_EM_CC2340R5_freertos_ticlang ****

"C:\\ti\\ccs1230\\ccs\\utils\\bin\\gmake" -k -j 8 all -O

Building file: "../gpioshutdown.c"
Invoking: Arm Compiler
"C:/ti/ccs1230/ccs/tools/compiler/ti-cgt-armllvm_2.1.3.LTS/bin/tiarmclang.exe" -c -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -Oz -I"C:/Users/paull_0duwwil/Dropbox/TI_CC2340R5Project/workspace_V0220_CC2340R5_CCS1230_SDK7100035_BLE5_GPIO_standby/gpiointerrupt_LP_EM_CC2340R5_freertos_ticlang" -I"C:/Users/paull_0duwwil/Dropbox/TI_CC2340R5Project/workspace_V0220_CC2340R5_CCS1230_SDK7100035_BLE5_GPIO_standby/gpiointerrupt_LP_EM_CC2340R5_freertos_ticlang/Debug" -I"C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source" -I"C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/kernel/freertos" -I"C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source/ti/posix/ticlang" -I"C:/ti/FreeRTOSv202104.00/FreeRTOS/Source/include" -I"C:/ti/FreeRTOSv202104.00/FreeRTOS/Source/portable/GCC/ARM_CM0" -DDeviceFamily_CC23X0R5 -gdwarf-3 -MMD -MP -MF"gpioshutdown.d_raw" -MT"gpioshutdown.o" -I"C:/Users/paull_0duwwil/Dropbox/TI_CC2340R5Project/workspace_V0220_CC2340R5_CCS1230_SDK7100035_BLE5_GPIO_standby/gpiointerrupt_LP_EM_CC2340R5_freertos_ticlang/Debug/syscfg" @"syscfg/ti_utils_build_compiler.opt" -o"gpioshutdown.o" "../gpioshutdown.c"
subdir_rules.mk:9: recipe for target 'gpioshutdown.o' failed
In file included from ../gpioshutdown.c:58:
In file included from C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source\ti/devices/cc23x0r5/driverlib/sys_ctrl.h:78:
In file included from C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source\ti/devices/cc23x0r5/driverlib/pwr_ctrl.h:70:
C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source\ti/devices/cc23x0r5/driverlib/osc.h:195:19: error: use of undeclared identifier 'AUX_DDI0_OSC_BASE'
DDI16BitWrite(AUX_DDI0_OSC_BASE, DDI_0_OSC_O_CTL0, DDI_0_OSC_CTL0_XOSC_HF_POWER_MODE,
^
C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source\ti/devices/cc23x0r5/driverlib/osc.h:217:25: error: use of undeclared identifier 'AUX_DDI0_OSC_BASE'
DDI16BitfieldWrite( AUX_DDI0_OSC_BASE, DDI_0_OSC_O_CTL0,
^
C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source\ti/devices/cc23x0r5/driverlib/osc.h:240:25: error: use of undeclared identifier 'AUX_DDI0_OSC_BASE'
DDI16BitfieldWrite( AUX_DDI0_OSC_BASE, DDI_0_OSC_O_CTL0,
^
C:/ti/simplelink_lowpower_f3_sdk_7_10_00_35/source\ti/devices/cc23x0r5/driverlib/osc.h:324:31: error: use of undeclared identifier 'AUX_DDI0_OSC_BASE'
return (DDI16BitfieldRead(AUX_DDI0_OSC_BASE, DDI_0_OSC_O_STAT0,

Here working project based on,

- PROJECT: C:\ti\simplelink_lowpower_f3_sdk_7_10_00_35\examples\rtos\LP_EM_CC2340R5\drivers\gpiointerrupt

- EVM: LP-EM-CC2340R5

- SDK: simplelink_lowpower_f3_sdk_7_10_00_35

- IDE: CCS V12.3.0

- OS: Windows 10

Regards,

Kevin

  • Hi Kevin,

    Thank you for the feedback, we definitely need to add this example to our SDK.

    I just wrote this example based on the gpiointerrupt example, the device entered in shutdown mode by  pressing left button and wake up by pressing the right one.

    Tell me if it works on your side,

    regards,

    /*
     * Copyright (c) 2015-2020, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== gpiointerrupt.c ========
     */
    #include <stdint.h>
    #include <stddef.h>
    #include <semaphore.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/power/PowerCC23X0.h>
    
    /* Driver configuration */
    #include "ti_drivers_config.h"
    
    static sem_t sem;
    
    /*
     *  ======== gpioButtonFxn0 ========
     *  Callback function for the GPIO interrupt on CONFIG_GPIO_BUTTON_0.
     *
     *  Note: GPIO interrupts are cleared prior to invoking callbacks.
     */
    void gpioButtonFxn0(uint_least8_t index)
    {
        /* Toggle an LED */
        GPIO_toggle(CONFIG_GPIO_LED_0);
        sem_post(&sem);
    }
    
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        /* Call driver init functions */
        GPIO_init();
    
        /* Configure the LED and button pins */
        GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(CONFIG_GPIO_BUTTON_0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
    
        /* Turn on user LED */
        GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
    
        /* Install Button callback */
        GPIO_setCallback(CONFIG_GPIO_BUTTON_0, gpioButtonFxn0);
    
        PowerLPF3_ResetReason resetReason = PowerLPF3_getResetReason();
    
        /* If we are waking up from shutdown, we do something extra. */
        if (resetReason == PowerLPF3_RESET_SHUTDOWN_IO)
        {
           /* Application code must always disable the IO latches when coming out of shutdown */
           PowerLPF3_releaseLatches();
        }
        int32_t semStatus;
        /* Create semaphore */
        semStatus = sem_init(&sem, 0, 0);
        if (semStatus != 0)
        {
          /* Error creating semaphore */
          while (1) {}
        }
    
        /* Enable interrupts */
        GPIO_enableInt(CONFIG_GPIO_BUTTON_0);
    
        /* Do not write until read callback executes */
          sem_wait(&sem);
    
          /* Configure DIO for wake up from shutdown */
          GPIO_setConfig(CONFIG_GPIO_BUTTON_1, GPIO_CFG_IN_PU | GPIO_CFG_SHUTDOWN_WAKE_LOW);
          /* Go to shutdown */
          Power_shutdown(0, 0);
    
          /* Should never get here, since shutdown will reset. */
              while (1) {}
    
        return (NULL);
    }
    

  • Hi Kevin,

    Based on the build log it appears that you have referenced a TI-RTOS7 CC2652R7 example for your Free-RTOS CC2340R5 project.  These RTOS versions are incompatible and my recommendation is that you import the CC2340R5 gpiostandby project, confirm that the build succeeds, and then compare the differences between the gpiostandby and gpioshutdown projects before applying the necessary changes to your base CC2340R5 gpiostandby project.  Here is a Quick Start Guide to help you set up your environment.  

    Regards,
    Ryan

  • Hi Guillaume, 

    The codes works well and stable between wakeup mode and shutdown mode by pressed on the same LEFT key 

    I had changed one line as following,

    for LEFT key pressed to wake up 

    /* Configure DIO for wake up from shutdown */

    GPIO_setConfig(CONFIG_GPIO_BUTTON_0, GPIO_CFG_IN_PU | GPIO_CFG_SHUTDOWN_WAKE_LOW); // changed 

    Any suggest method, if I want to press and hold the LEFT key for 3 seconds to do shudown mode and wakeup mode as before?

    Regards,

    Kevin

  • Hi Kevin,

    I suggest you to have a look at the menu in the basic_ble example, in common>MenuModule you'll find am example on button long press and button press. In the parameters of Button_Params you'll find one called longPressDuration. It should be useful for your application.

    regards,

  • Hi Guillaume, 

    Thanks again, I will try to look Button_Params for longPressDuration what you mentioned

    Here I want to close this thread

    Regards,

    Kevin