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.

CC2640R2 multirole

Hello Everyone,

I am new in CC2640R2 launchpad and SDK-v3.0.

I am using multirole application in CC2640R2 launchpad with SDK-v3.0.

The multirole application is running on CC2640R2 launchpad So I wants to connect CC2640R2 launchpad (multirole application running) with other running ble device and get data from that devices.

So My question is how to get characteristic value from BLE device to CC2640R2 launchpad which running on multirole application?

Where I can get the actual characteristic value in multi_role.c file.

Any help will be appreciated.

Thanks

Mahesh

  • Hi Mahesh,

    In multi_role_processGATTDiscEvent(), the program looks for Simple Service, and if it's found multi_role discovers characteristic and stores it in charHdl.

    If you navigate through the memory and do a read request, mr_doGattRw() is called and sends an attReadReq_t.

        // Do a read
        else
        {
          // Create read request...place in CSTACK
          attReadReq_t req;
    
          // Fill up read request
          req.handle = discInfo[index].charHdl;
    
          // Send read request. no need to free if unsuccessful since the request
          // is only placed in CSTACK; not allocated
          status = GATT_ReadCharValue(connHandleMap[index].connHandle, &req, selfEntity);
        }

    According to the BLE spec, the slave will give an ATT_READ_RSP or ATT_ERROR_RSP. These are picked up in multi_role_processGATTMsg():

    // Find index from connection handle
        connIndex = multi_role_mapConnHandleToIndex(pMsg->connHandle);
        if ((pMsg->method == ATT_READ_RSP)   ||
            ((pMsg->method == ATT_ERROR_RSP) &&
             (pMsg->msg.errorRsp.reqOpcode == ATT_READ_REQ)))
        {
          if (pMsg->method == ATT_ERROR_RSP)
          {
            Display_print1(dispHandle, MR_ROW_STATUS2, 0, "Read Error %d", pMsg->msg.errorRsp.errCode);
          }
          else
          {
            // After a successful read, display the read value
            Display_print1(dispHandle, MR_ROW_STATUS2, 0, "Read rsp: %d", pMsg->msg.readRsp.pValue[0]);
          }
    
        }

  • Thanks for quick response.

    How can we enable attribute notify in multirole (I need this because when other ble device send attribute data so I can receive it in multi role device)?

    Can we use instead of simpleProfile to any other custom profile for read the attribute value?

    Thanks

    Mahesh
  • Hi Mahesh,

    The attribute must be configured to enable notifications. Each attribute has a Client Characteristic Configuration, that the master can set to 1 in order to "subscibe to notifications". You can read more about this in Simplelink Academy: software-dl.ti.com/.../ble_01_custom_profile.html

    If you want to use Simple Profile, Characteristic 4 already has the GATT_PROP_NOTIFY property.

    You can use any custom profile in stead of Simple Profile, e.g. use GATT_DiscPrimaryServiceByUUID() with your custom UUID.
  • Thanks for Replay.

    How can we enable notification in client mode in multirole?

    Thanks

    Mahesh
  • Hi Mahesh,

    multi_role as advertiser/slave/client has the simple profile, so you can use characteristic 4 in this profile.
  • Hi Mahesh,

    You can also use characteristic 1 in simple profile by adding GATT_PROP_NOTIFY to its characteristic and you can read and write through characteristic 1 itself.

    Regards,
    Abhishek Yakkundi

    Please press Verify Answer below if this answered your question.
  • Hi Abhishek,

    Can you please send code spinet where are you enable notify in multi-role application?

    Thanks

  • Hi Rajneesh,

    You should notify in simpleProfile and then any change in simpleProfile character can be seen in multirole in Process value change event function.

    Regards,
    Abhishek Yakkundi

    Please press Verify Answer below if this answered your question.