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: Custom BLE profile

Part Number: CC2340R5


Tool/software:

Hi,

I would like to know if there is a an example code on how to add custom BLE profile in CC2340R5 controller and also how can I change the bond related parameters ?

Thanks in advance

  • Hi !

    The "Take control over the GATT Table" section of the SLA on SimpleLinkTm basic_ble examples shows how one can modify the values of the characteristics in the GATT table.

    It's also possible to add services and characteristics, you can see the app_simple_gatt.c file in the basic_ble project to see how one can do it. This code uses the SimpleGattProfile library to add those services and characteristics, but if this library is too constraining for you, you can find the code used by the library in common/Profiles/simples_gatt/simple_gatt_profile.c file, and you can try to change it/make your own library for interfacing with the GATT table by using the code in the SimpleGattProfile library.

    I would also add that reading about the GAP chapter and the GATT chapter of the BLE5-Stack user guide would be a good starting point for learning about profiles and what they entail.

    To change the bonds related parameters, you can use the GAPBondMgr_SetParameters function. You can find all the Bond related functions in the API here.

    Kind regards,
    Maxence

  • Hi Maxence, Thanks for the reply I tried adding a custom service and characteristics following the same method and it is added properly. I am trying to change the UUID to a custom 128bit in the basic ble example code

    #define CUSTOM_SERVICE_UUID_BASE(uuid) 0x34, 0x65, 0x68, 0x40, 0x97, 0x23, LO1_UINT16(uuid), HI1_UINT16(uuid), \
    0x09, 0x45, 0x78, 0x98, 0xCB, 0x34, 0x45, 0x23
    #define GATT_UUID_C(name, UUID) const uint8 name[ATT_UUID_SIZE] = {CUSTOM_SERVICE_UUID_BASE(UUID) }

    // Custom GATT Profile Service UUID: 0x000A
    GATT_UUID_C(customGattProfile_ServUUID, CUSTOMGATTPROFILE_SERV_UUID);

    // Characteristic 1 UUID: 0x001A
    GATT_UUID_C(customGattProfile_char1UUID, CUSTOMGATTPROFILE_CHAR1_UUID);

    The service is added properly with the custom 128 bit UUID. but the characteristic UUID is being printed as 0X3449. and also I tried to modify the characteristics description in the code. It is not getting reflected in the mobile Application

    Thanks in advance

  • Hi !

    Your error could come from many different sources, such as adding your characteristic to the simpleGattProfile_attrTbl variable by calling GATT_BT_ATT instead of GATT_ATT (128 bits version of GATT_BT_ATT), or initializing your characteritics UUID with GATT_BT_UUID instead of GATT_UUID.

    Could you please check if you did not mistakenly use a 16 bits version of a function instead of a 128 bits function ?

    Kind regards,
    Maxence