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.

CC2340R5: CC2340R5 device used for sending continuous data after connection

Part Number: CC2340R5

Tool/software:

Hi,

I am using 3 cc2340r5 board for some operation  i am using one device as central + peripheral, one as central and one as peripheral.

so, when c+p device is connected to both different central and peripheral at that time data is not coming or going but when c+p is connected with central or peripheral separately the data is coming, but connected with 2 devices the data is not coming.

can you guide to overcome from this problem, how to send data to the multiple devices at time when it connected.

  • Hello,

    Thanks for posting on the E2E forums. I have a couple questions that can help us debug this.

    1. What SDK are you using for the project?

    2. How are you transferring data between the devices? How many bytes are being sent?

    2.5. Which device is initiating the transfer of data?

    3. Are the devices bonded/paired?

    4. To make sure I'm understanding the problem at hand: When all three devices are connected, no data is being transferred. However, when C+P is connected to either the Central or Peripheral, but not both, data is being transferred correctly.

    Best,

    Nima Behmanesh

  • hello Nima,

    thanks for your response,

    IC- CC2340R5

    SDK version -simplelink_lowpower_f3_sdk_7_40_00_64

    CCS version - 12.6

    for this communication we are using CC2340R5 (device act as central as well as peripheral) and C+P currently we are using the CC2340R5 device.

    1. for central + Peripheral device we are using the SDK simplelink_lowpower_f3_sdk_7_40_00_64 and CCS version is 12.6

    for the central device and peripheral device separately, we are using the CC2340R5 device and SDK is simplelink_lowpower_f3_sdk_7_40_00_64

    2. we are sending data from the C+ P device to central device (we are sending this data continuously after connection establishment) and size of data is 1 byte.

    2.5 C+P will be initiating the transfer of data to the central device (but in our case Central and peripheral 2 devices connected with C+P at that C+P will send continuously data to the central device, but we are not getting data to the central device continuously from C+P device but C+P device sending data continuously to the central device CHAR UUID).

    3. yes 

    4. yes, when C+P is connected with central or either peripheral at that time its sending data continuously, but when all three devices connected to each other C+P is sending data to central device (while debugging data is not coming to the central device).

    please response as earlier you can.

    Thanks and regards

    Balaji Wankhede

  • Hi Balaji,

    2. we are sending data from the C+ P device to central device (we are sending this data continuously after connection establishment) and size of data is 1 byte.

    Is this done through a GATT service?

    I'm going to try to reproduce this on my side but will need some more information about how the 1 byte is being sent.

    Best,

    Nima Behmanesh

  • Hello sir,

    Thanks for your response

    using GATT only we are trying to send.

    it is working fine when C+P device is connected with central or peripheral but when it is connected with both central and peripheral then we are facing problem (C+P device sending data to the first connected device not second one).

    what more information do you need?

    we are trying to send data from the C+P device to the central and peripheral device after connection (C+P device is our main ECU and central is mobile app and peripheral is another device that is connected with our main ECU).

    thanks, and Regards

    Balaji Wankhede

  • Hi Balaji,

    Thank you for the information, I think I have enough now to try to reproduce. I'll get back to you once I have and see if I'm missing anything

    Best,

    Nima Behmanesh

  • Hi Balaji,

    In which handler is the device sending the data from?

    I'm assuming both app_central.c and app_peripheral.c are being compiled and used and that the logic to send the data is being sent in a handler.

    What event is the handler(s) using to send the data? 

    I'm thinking that there is a collision, and that only one of the events for one of the handlers is being triggered.

    Best,

    Nima Behmanesh

  • Hello Nima ,

    Thanks for your response.

    we are using GATT handler for sending data from one device to another connected device in which we are sending data on specific char of the connected device.

    static void GATT_EventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData);

    // Events handlers struct, contains the handlers and event masks
    // of the application data module
    BLEAppUtil_EventHandler_t dataGATTHandler =
    {
    .handlerType = BLEAPPUTIL_GATT_TYPE,
    .pEventHandler = GATT_EventHandler,
    .eventMask = BLEAPPUTIL_ATT_FLOW_CTRL_VIOLATED_EVENT |
    BLEAPPUTIL_ATT_MTU_UPDATED_EVENT
    };

    for sending data from created gatt_write() function when we called gatt_write() it will send data from one device another connected device through the particular char of the connected device.

    in this condition C+P device sending data but data is receiving on only one device.

    We tried to send data from C+P device to the two different char of two connected device in that condition also same problem happen.

    we tried all the possible ways but we are able to solve this problem please kindly check with your BLE expert.

    Thanks Regards

    Balaji Wankhede 

  • Hi Balaji,

    Can I please see the implementation of the code handling the sending and receiving on the C+P side?

    Just to clarify, the data is sent after the link established event correct? Is it based off a timer that ever N ms, seconds, etc. it's being sent? Is there a list of connection handles for the connected devices?

    I'm still trying to reproduce it on my side, but knowing more about how the application is handling will help.

    Update:

    After looking into this further, I do believe that the connection handle may be the reason you are seeing that behavior.

    it is working fine when C+P device is connected with central or peripheral but when it is connected with both central and peripheral then we are facing problem (C+P device sending data to the first connected device not second one)

    1. How are you managing the connection handle of the second device? 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    void Peripheral_GAPConnEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
    {
    switch(event)
    {
    case BLEAPPUTIL_LINK_ESTABLISHED_EVENT:
    {
    /** CODE TO BE ADDED **/
    BLEAppUtil_gapConnData_t *msg = (BLEAppUtil_gapConnData_t *)pMsgData;
    /** CODE TO BE ADDED END **/
    /* Check if we reach the maximum allowed number of connections */
    if(linkDB_NumActive() < linkDB_NumConns())
    {
    /* Start advertising since there is room for more connections */
    BLEAppUtil_advStart(peripheralAdvHandle_1, &advSetStartParamsSet_1);
    }
    else
    {
    /* Stop advertising since there is no room for more connections */
    BLEAppUtil_advStop(peripheralAdvHandle_1);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    The code above indicates the connection handle of the connected device, as well as the role it connected with. Please add code to verify the connection handle before the GATT_write to verify that you are using the correct connection handle when sending the information. See /** CODE TO BE ADDED **/ comments.

    Best,

    Nima Behmanesh