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: BLE write characteristic

Part Number: CC2640R2F

I have a cc2640r2f chip for BLE application, It all working fine in notify characteristic, but couldn't define write characteristic properly so can help me with how can I enable write characteristic and once write some input in that characteristic to get the continuous data ??

any reference example or something can you provide me?

I checked in https://www.ti.com/tool/SIMPLELINK-CC2640R2-SDK,  but in SDK there's nothing like write characteristic reference!! I need those references which provide me the BLE write characteristic and get the continuous data!!

  • Hey Umang,

    Please refer to our Simplelink Academy modules on Bluetooth Low Energy Fundamentals, as well as our Custom Profile module. In addition, you can find the characteristics defined inside simple_gatt_profile.c where we make use of write characteristics.

  • Hi Ammar,

    I go through your suggested steps and I am able to generate write characteristics, but when I press the "W" button in the application, there's a pop-up menu to write some data and I don't know what input I have to write to get continuous data!!

    This means that, in code, where exactly do I have to write my specific input so that I can able to get data when I put that value in write !!

  • Hey Umang,

     I am confused. Can you elaborate a bit on your setup and what you are trying to do?

    When you say:

    there's a pop-up menu to write some data and I don't know what input I have to write to get continuous data!!

    where do you see this? Moreover, what device are you using as your central? Are you using a mobile app?

    in code, where exactly do I have to write my specific input so that I can able to get data when I put that value in write !!

    The central device usually writes to characteristics. Once the central writes to the characteristic, the peripheral will invoke the appropriate write callback. For more information, there's a section on our User's Guide called Read and Write Callback Functions.

  • Greetings Ammar,

    Apologies for the confusion!

    I have a BLE scanner app, where I want to write some input in write characteristics, and in response, I want to get continuous data!! 

  • Hey Umang,

    Thanks for clarifying! Please take a look at simple_peripheral.c:: SimplePeripheral_performPeriodicTask() function. If you recall in the Simplelink Academy module Fundamentals training, Task 3 enables notifications for SIMPLEPROFILE_CHAR4.

    Writing to the CCCD of SIMPLEPROFILE_CHAR4 will enable notifications. Once enabled by the scanner app, every 5 seconds the application will send the data stored in SIMPLEPROFILE_CHAR3 to your phone via notifications. You can expand on this by calling simpleProfile_SetParameter() as is done in the periodic task. Keep in mind the comment above that line as well. You'll have to modify this further for larger size notifications (more than one byte).

    Take a look at our Github Examples for our throughput_central and throughput_peripheral, which send continuous data from the central to the peripheral. Note this demo will require 2 CC26x2's, you will not be able to test this out of the box with a smartphone.