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: how to update character value from another task

Part Number: LP-EM-CC2340R5


I have created another task in basic_ble on the perphiral side and call 

SimpleGattProfile_setParameter( SIMPLEGATTPROFILE_CHAR4, sizeof(uint8_t), &charValue4 );
but it will crash as long as the central device connect to it.
Do we have an example for this operation?
  • Hi,

    Based on your description I am assuming you are calling SimpleGattProfile_setParameter from a non-BLE task. You can use the BLEAppUtil_invokeFunctionNoData and BLEAppUtil_invokeFunction functions to switch the context to the BLE App Util task context. Please take a look at the following snippet:

    void myHandler(void *pData)
    {
        // ... insert your code here
        SimpleGattProfile_setParameter( SIMPLEGATTPROFILE_CHAR4, sizeof(uint8_t), &charValue4 );
    }
    
    void *myTask(void *arg0)
    {
        // ...
        char *data = BLEAppUtil_malloc(sizeof(char));
        BLEAppUtil_invokeFunction(myHandler, data);
    }

    It's also possible to create additional ICall enabled tasks as described in the User's Guide (Tasks — SimpleLinkTm CC23xx SDK BLE5-Stack User's Guide 3.02.04.00 documentation) but I do not recommend it from what I understand of your use case.