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.

CC2642R: Peripheral using CC2642R connected with CC2640R2F and mobile device (android/ios)

Part Number: CC2642R
Other Parts Discussed in Thread: CC2640R2F,

Hello everyone.

I have a project running a peripheral with oad offchip. The peripheral is controlled from application running into mobile (android/ios) device and it accepts just one connection for time. 

Now, I need connect a second device (maybe a CC2640R2F) for controlling that peripheral. My doubt is the following:

1- Is it possible the peripheral to accept more than one connection in same time?

2- If the question one is true, is it possible to establish connection between CC2640R2F and CC2642R with a command of mobile application connected previously?

In resume, I need to connect one CC2640R2F and one mobile device in the same time to control the peripheral. The device with CC2640R2F will not have display, so I think to use the application mobile to establish connection.

I will appreciate any advice of you. Thanks in advanced. 

  • Hi,

    1- Is it possible the peripheral to accept more than one connection in same time?

    Yes, it is possible for a single peripheral device to be connected to multiple centrals. You will need to re-enable connectable advertisements if they are being disabled after a connection is established.

    2- If the question one is true, is it possible to establish connection between CC2640R2F and CC2642R with a command of mobile application connected previously?

    This may be a bit tricky, but should be possible. You should enable one of the devices to operate in multirole (central + peripheral). A smartphone device can then scan and connect to the multi-role device and afterwards the multi-role device can be made to scan and connect to the second device in peripheral role. Add some logic to your multirole project to scan and connected based on a given characteristic being set to a specific value and this will allow you to kick off the scan and connection process through a mobile application.

    Best Regards,

    jan

  • Ok, I like your approach, but I need help with some stuffs. I will divide my doubt in parts to do not confusion here.

    What is the properly manner to re-enable connectable advertisements in CC2642R? I am looking for material but I did not found any thing related to that.

  • Hi,

    No worries! I would highly recommend referencing the SimpleLink Academy. Specifically, the Scanning & Advertising lab provides a lot of valuable information on how advertising works and how to modify the default advertising behavior.

    Best Regards,

    Jan

  • Hi Jan, thank you for your advice. Now I can to connect to a peripheral, but I unable to write data to it.

    void write(uint8_t value)
    {
        bStatus_t status;
    
        attWriteReq_t req;
    
        req.handle = ???????????
        req.pValue = GATT_bm_alloc(connHandleMap[0].connHandle, ATT_WRITE_REQ, 1, NULL);
        req.len = 1;
        req.pValue[0] = value;
        req.sig = 0;
        req.cmd = 0;
    
        status = GATT_WriteCharValue(connHandleMap[0].connHandle, &req, selfEntity);
        if ( status != SUCCESS )
        {
            GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
        }
    
    }

    In the code above what to assignment req.handle???? is the UUID of characteristic??

  • Hi,

    That will be the handle of the attribute you are attempting to write to in the GATT attribute table. I highly recommend referencing the simple_central project as this project already performs writes by default and will be a good place to reference code from.

    Best Regards,

    Jan

  • Ok. I am using the multi_role project for POC.There are a variable named disInfo with info of services and characteristics discovered and I can see a handle which I think belongs to char1 of simple_peripheral project. How can I check the handle of each characteristic???

  • Hi,

    There are a few different ways that a handle may be found and which should be used depends on how you are implementing your program.

    1. If you would like to discovery every single characteristic, then the GATT_DiscAllPrimaryServices() function may be best.

    2. If you would like to discovery only the characteristics that match a certain UUID, then the GATT_DiscCharsByUUID() function will be able to provide this.

    3. If you want to discovery only primary services by UUID, then the GATT_DiscPrimaryServiceByUUID() would be helpful.

    There are a few more discovery functions in the GATT API guide: https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_7_10_02_23/docs/ble5stack/ble_user_guide/doxygen/ble/html/group___a_t_t___g_a_t_t.html#gaa9323c71f318bcf8a1cddad9ac4458ac

    Which may be helpful depending on how you would like to organize your logic.

    Best Regards,

    Jan