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.

CCS/LAUNCHXL-CC1352R1: Thread +BLE run simultaneously using DMM

Other Parts Discussed in Thread: SYSCONFIG, SYSBIOS

Hello community,

I have an interest in running BLE 5 and Thread simultaneously  for CC1352R1.

I  used following example

project_zero_app_CC13X2R1_LAUNCHXL_tirtos_ccs  For BLE

doorlock_oad_secure_CC1352R1_LAUNCHXL_tirtos_ccs  For Thread

I follow this link to setup DMM.

Here I follow some  step .

add

According to link I add DMM ,Ble and thread.

Am I following right way to Setup?

How am I find activity table for thread shown in dmm_priority_ble_zigbee.c?

  • Hello Nikunj,

    I'm glad you were able to find the DMM SLAs, I would also recommend reviewing the DMM policy table and SysConfig sections of the DMM User's Guide:

    http://dev.ti.com/tirex/content/simplelink_cc13x2_26x2_sdk_3_40_00_02/docs/dmm/dmm_user_guide/html/dmm/states-and-policies.html#dmm-policy-table 
    http://dev.ti.com/tirex/content/simplelink_cc13x2_26x2_sdk_3_40_00_02/docs/dmm/dmm_user_guide/html/sysconfig/dmm-sysconfig.html#sec-dmm-sysconfig 

    Since Zigbee and Thread are both mesh 802.15.4 Specifications then you should be able to use the Zigbee + BLE DMM examples as a guide.  Notice how the dmm_priority_ble_zigbee.h actually weighs priority of 15.4 activity.  http://dev.ti.com/tirex/explore/node?node=AKGrqjvlAfvpaj2sPTdBtQ__pTTHBmu__LATEST 

    Regards,
    Ryan

  • Here I  set  the parameter  according   to this "dmm_zed_switch_remote_display_oad_app_CC1352R1_LAUNCHXL_tirtos_ccs" example.

    was that correct? if not then where to find RF_Activity parameter For Thread?

    Thanks and Regards,

    Nikunj

  • I do not notice anything wrong with this setup, please let us know if you encounter any specific issues after initializing the DMM policy manager.

    Regards,
    Ryan

  • Hello,Ryan

    Thanks for Your Reply.

    As per the below link I  Build  DMM enabled Project Zero Successfully.

    But I have an issue when I add the Thread stack (temp_sensor_CC1352R1_LAUNCHXL_tirtos_ccs) .

  • Hello Nikunj,

    Merging these two examples will take advanced knowledge of CCS project structure, for example several modifications will be required to the Project Properties -> Build -> ARM Compiler -> Include Options & Predefined Symbols and ARM Linker -> File Search Path.  This is especially important for a Thread project which uses third-party OpenThread core/libraries as well as referencing other projects which should be in the workspace.  I recommend using Difference Comparison software to further assist your evaluation of what is missing and should be included.

    Regards,
    Ryan

  • Hello Ryan,

    Thanks for reply,

    "several modifications will be required to the Project Properties -> Build -> ARM Compiler -> Include Options & Predefined Symbols and ARM Linker -> File Search Path.  This is especially important for a Thread project which uses third-party OpenThread core/libraries as well as referencing other projects which should be in the workspace" as you mentioned I included following in my workspace,

    Here are Project Properties -> Build -> ARM Compiler -> Include Options,

    ${INHERITED_INCLUDE_PATH}
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/third_party/openthread/src/core
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/third_party/openthread/third_party/mbedtls/repo/include
    ${REF_PROJECT_2_LOC}/config
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/third_party/openthread/include
    ${REF_PROJECT_1_LOC}/config
    ${PROJECT_ROOT}/platform/crypto
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/third_party/openthread/examples/platforms
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INCLUDE_PATH}
    ${PROJECT_ROOT}/Application/project_zero
    ${PROJECT_ROOT}/Application/thread
    ${PROJECT_ROOT}/dmm
    ${PROJECT_ROOT}
    ${PROJECT_ROOT}/${ConfigName}
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/examples/rtos/CC1352R1_LAUNCHXL/ble5stack/project_zero/Application
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/common/cc26xx/
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/boards/CC1352R1_LAUNCHXL/
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/drivers/nvs/
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/common/cc26xx/oad/
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/profiles/oad/cc26xx
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/common/../
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/controller/cc26xx/inc
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/inc
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/rom
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/common/cc26xx
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/icall/inc
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/hal/src/target/_common
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/hal/src/target/_common/cc26xx
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/hal/src/inc
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/heapmgr
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/profiles/dev_info
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/profiles/simple_profile
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/icall/src/inc
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/osal/src/inc
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/services/src/saddr
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/services/src/sdata
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/common/nv
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/common/cc26xx
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/devices/cc13x2_cc26x2
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/posix/ccs
    ${CG_TOOL_ROOT}/include

    Project Properties -> Build -> ARM Compiler -> Predefined Symbols

    ${INHERITED_SYMBOLS}
    BLE_START
    HAVE_CONFIG_H
    BOARD_DISPLAY_USE_UART=1
    Board_EXCLUDE_NVS_EXTERNAL_FLASH
    SIMPLELINK_OPENTHREAD_SDK_BUILD=1
    SIMPLELINK_OPENTHREAD_CONFIG_MTD=1
    SIMPLELINK_OPENTHREAD_CONFIG_CC1352=1
    OPENTHREAD_CONFIG_FILE='"openthread-config-cc1352-ccs-mtd.h"'
    OPENTHREAD_PROJECT_CORE_CONFIG_FILE='"openthread-core-cc1352-config-ide.h"'
    MBEDTLS_CONFIG_FILE='"mbedtls-config-cc1352-ccs.h"'
    BOARD_DISPLAY_USE_LCD=0
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_SYMBOLS}
    USE_DMM
    uartlog_FILE="\"${InputFileName}\""
    SECURITY
    DeviceFamily_CC13X2

    ARM Linker -> File Search Path -> 

    ${INHERITED_LIBRARIES}
    third_party/spiffs/lib/ccs/m4f/spiffs_cc26xx.a

    libopenthread_mtd.a
    libopenthread_platform_utils_mtd.a
    libmbedcrypto.a
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_LIBRARIES}
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/dmm/library/tirtos/ccs/bin/dmmlib_cc13x2.a
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/libraries/cc13x2r1/OneLib_coc.a
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/libraries/cc13x2r1/StackWrapper_coc.a
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/ble5stack/libraries/cc13x2r1/ble_r2_coc.symbols
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/examples/rtos/CC1352R1_LAUNCHXL/ble5stack/project_zero/tirtos/ccs/cc13x2_cc26x2_app.cmd
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/display/lib/display.aem4f
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/grlib/lib/ccs/m4f/grlib.a
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.aem4f
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/devices/cc13x2_cc26x2/driverlib/bin/ccs/driverlib.lib
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/source/ti/drivers/lib/drivers_cc13x2.aem4f
    ${COM_TI_SIMPLELINK_CC13X2_26X2_SDK_INSTALL_DIR}/kernel/tirtos/packages/ti/dpl/lib/dpl_cc13x2.aem4f
    ti/devices/cc13x2_cc26x2/driverlib/bin/ccs/driverlib.lib
    libc.a

    Still I found errors after adding this.

    can you tell me what should I include to solve?

    Thanks and regards,

    Nikunj panchani

  • Are the errors different or the same?  Please search for similar issues on the E2E.

    Regards,
    Ryan

  • All of these errors have to do with the <sdk_directory>/source/ti/posix/ccs files.  Please clean the project and re-verify your compiler include paths.

    Regards,
    Ryan

  • I successfully removed error after modifying project_zero.cfg file. I included following

    /* ================ POSIX configuration ================ */
    var Settings = xdc.useModule('ti.posix.tirtos.Settings');
    Settings.enableMutexPriority = true;

     I didn't understand how to to initialize pthreadTaskHndl for thread protocol

    here is my modify main function for DMM application.

    int main()
    {
        Task_Handle* pBleTaskHndl;
        Task_Handle* pthreadTaskHndl;

         DMMSch_Params dmmSchedulerParams;
         DMMPolicy_Params dmmPolicyParams;

         /* Register Application callback to trap asserts raised in the Stack */
         RegisterAssertCback(AssertHandler);

         Board_initGeneral();

       #if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
           Display_init();
       #endif

           GPIO_init();

           NVS_init();

           ECJPAKE_init();

           AESECB_init();

           SHA2_init();

       #if !defined( POWER_SAVING )
         /* Set constraints for Standby, powerdown and idle mode */
         // PowerCC26XX_SB_DISALLOW may be redundant
         Power_setConstraint(PowerCC26XX_SB_DISALLOW);
         Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
       #endif // POWER_SAVING

           /* Update User Configuration of the stack */
           user0Cfg.appServiceInfo->timerTickPeriod = Clock_tickPeriod;
           user0Cfg.appServiceInfo->timerMaxMillisecond = ICall_getMaxMSecs();

           /* Initialize the RTOS Log formatting and output to UART in Idle thread.
            * Note: Define xdc_runtime_Log_DISABLE_ALL and remove define UARTLOG_ENABLE
            *       to remove all impact of Log statements.
            * Note: NULL as Params gives 115200,8,N,1 and Blocking mode */
           UART_init();
           UartLog_init(UART_open(CONFIG_DISPLAY_UART, NULL));

       #ifdef BLE_START
         /* Initialize ICall module */
         ICall_init();
         /* Start tasks of external images */
         ICall_createRemoteTasks();
         pBleTaskHndl = ICall_getRemoteTaskHandle(0);
         ProjectZero_createTask();
       #endif



        #ifdef THD_START

         TempSensor_taskCreate();

        #endif


           /* Initialize and open the DMM policy manager */

                  DMMPolicy_init();
                  DMMPolicy_Params_init(&dmmPolicyParams);
                  dmmPolicyParams.numPolicyTableEntries = DMMPolicy_ApplicationPolicySize;
                  dmmPolicyParams.policyTable = DMMPolicy_ApplicationPolicyTable;
                  dmmPolicyParams.globalPriorityTable = globalPriorityTable_blethread;
                  DMMPolicy_open(&dmmPolicyParams);

                  // Initialize and open the DMM scheduler
                  DMMSch_init();
                  DMMSch_Params_init(&dmmSchedulerParams);
                  memcpy(dmmSchedulerParams.stackRoles,
                         DMMPolicy_ApplicationPolicyTable.stackRole,
                         sizeof(DMMPolicy_StackRole) * DMMPOLICY_NUM_STACKS);
                  dmmSchedulerParams.indexTable = DMMPolicy_ApplicationPolicyTable.indexTable;
                  DMMSch_open(&dmmSchedulerParams);

                  // Register clients with DMM scheduler
                  DMMSch_registerClient(pBleTaskHndl, DMMPolicy_StackRole_BlePeripheral);
                  DMMSch_registerClient(pthreadTaskHndl, DMMPolicy_StackRole_154Sensor);

                  DMMPolicy_updateStackState(DMMPolicy_StackRole_BlePeripheral, DMMPOLICY_BLE_ADV);
                  DMMPolicy_updateStackState(DMMPolicy_StackRole_154Sensor, DMMPOLICY_TD_UNINIT);


           /* enable interrupts and start SYS/BIOS */
           BIOS_start();

        return(0);
    }

  • This is because other stacks initialize the stacks with ti/sysbios/knl/Task.h whereas Thread uses ti/posix/ccs/pthread.h, you will need to figure out how to resolve this.  https://stackoverflow.com/questions/21091000/how-to-get-thread-id-of-a-pthread-in-linux-c-program 

    Regards,
    Ryan