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.

CC2640R2F-Q1: Bluetooth low energy custom profile - service and characteristics creation

Part Number: CC2640R2F-Q1
Other Parts Discussed in Thread: CC2640R2F

Dear All,

I am using the LAUNCHXL-CC2640R2F evaluation module—currently, I learned the BLE programming structure. 

I faced some difficulty in the "Bluetooth low energy custom profile" procedure with creating a new service and characteristics. You can find this tutorial in the below-mentioned link. 

https://dev.ti.com/tirex/explore/content/simplelink_academy_cc2640r2sdk_4_30_01_00/modules/blestack/ble_01_custom_profile/ble_01_custom_profile.html#gatt-server-callbacks

Up to task 3, I have understood the procedure of creating service and characteristics. Even I checked through my mobile that I can able to view my newly created service and characteristics. 

Task 4 is about the payload data transfer "value." Actually, I couldn't be able to follow what is mentioned in that task. Literally, I am doing the same as it mentioned, but I have not got the same as it mentioned. 

// See if request is regarding the sun light value Characteristic Value ---------------

if ( ! memcmp(pAttr->type.uuid,sunlightService_SunlightValueUUID, pAttr->type.len) )

{

*pLen = 4;

memcpy(pValue, pAttr->pValue + offset, *pLen);

}

//-----------------------------------------

Please let me that where I did the mistake.

Thank you,

Prakash S

  • Hi,

    There is a Bluetooth Service Generator at SimpleLinkAcademy->Bluetooth4.2 ->Custom Profile. See, this link.

    -kel

  • Dear Kel,

    The link which I mentioned in my previous mail, as well as what you have suggested in your mail, both are the same.

    Actually, I got stuck just after task 3, "Add characteristics". I can create the characteristics, and I can able to view those characteristics on my mobile using the "nRF Connect" app. But I can't view the value of that particular characteristics. 

    To View the value, I need to proceed the task 4, "Add API and Call back Handling"  Below, I have shown the instructions of task 4.

    1. ."In sunlightService_ReadAttrCB in your code, insert an if-clause that compares the requested UUID with the UUID of your characteristic.
    2. Optionally, inside the if-clause, set *pLen equal to 4, or follow the generic pattern
    3. Copy the value of pAttr->pValue into pValue. The length is 4, or optionally following the generic pattern and using the #define you have made for the length.Connect and try to read the characteristic. What is the value?
      • What does pAttr point to? What is the data type? What about pAttr->pValue?
    4. Change the initial value of the Characteristic Value attribute's value field. Re-flash and try to read it again.

    But all the instruction is already is there in the code, Which I generated with the help of "Example service generator" . I don't know how to proceed further. If any options are there, please let me know.

     

    Thank you,

    Prakash S

     

     

  • Hi Prakash,

    Ah okay so you are following the simplelink academy, not sure if that is updated. But, I will give you tip. Use the simple peripheral example program, you can see that the characteristics value can be changed and viewed at your app.

    Next step you can remove the simple profile and then add a custom Bluetooth service using the service generator from the simplelink academy. 

    -kel

  • Dear Kel,

    I am using updated module only "simplelink_cc2640r2f_sdk_4_40_00_10". 

    Actually, in the BLE custom profile tutorial, it is mentioned to use the "Project_zero" module. But you are suggesting me to use a simple peripheral. Is that fine?

    Thank you,

    Prakash S

  • Prakash S20 said:

    Actually, in the BLE custom profile tutorial, it is mentioned to use the "Project_zero" module. But you are suggesting me to use a simple peripheral. Is that fine?

    You can skip that simplelink academy. Just keep the learnings. Then move on to simple peripheral, which is recommended starting point for project or product development.

    -kel

  • Dear Kel,

    Thanks for the suggestions, maybe I will think about it.

    Since I am new to the wireless (BLE) environment, I am in a situation to follow whatever is given in the tutorial and feel very reluctant to try something other than the mentioned one because there are high possibilities for making mistakes. 

    Ok, thank you, Kel.

    Prakash S

  • Hello Prakash,

    The code generated by the example generator will include solutions to Task 3 and 4 in the Custom Profile SLA lab. This lab is designed to work with the Project Zero application, but all of the concepts can be applied to other applications. As Kel mentioned, everything covered can be applied in the Simple Peripheral project by following very similar steps.

    If your goal is to implement a custom profile in your application, then it might be a somewhat easier to use Simple Peripheral as the framework instead of Project Zero. Project Zero is similar to Simple Peripheral, but with additional features that you may not require for you application.

    Regards,

    Jan

  • Dear Kel and Jan,

    The Problem which I was mentioned before is solved. Now I can able to see the value through my mobile using the "nRF Connect" app. In task 3 mentioned that the characteristics should need to configure with the features of readable and notifications. Before, I generated code with the features of "read" in "properties" only. Now It has been configured with both "properties (shown in declaration)" and "permission(for ATT requests)". 

    This helps me solve this issue. 

    Thanks for the suggestions,

    Regards

    Prakash S