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: Continuous data flow (update and transfer through BLE characteristics value) using loop

Part Number: CC2640R2F

Hi all,

I'm a beginner to BLE. Please help me out.

Requirement - I have a large set of  data saved in the flash of the CC2640R2F flash (approximately - 100 Byte frames x 1000). I want to send all these data to I-phone (Which has a app that accept data and save it [This part already there]) in a single connection with the phone.

What I have done so far - I tried out simple_peripheral example program it on CC2640R2F LP. and connected with I phone app. Filtered only to read characteristic 5 value (Which is a string of 40Bytes).

What I want - I want to use this example and send the required amount of data (above mentioned) to I-phone by looping it in the "SimpleBLEPeripheral_performPeriodicTask()" function. I know that this function is looping in every 5 seconds (SBP_PERIODIC_EVT_PERIOD). If I can loop it in every 1ms and use it to transfer small frames (64Bytes) I will able to transfer the data in few seconds.

* I use SimpleProfile_SetParameter() to update the value of characteristic 5  in "SimpleBLEPeripheral_performPeriodicTask()" function which is looping. It didnt work.

I want to know how to send data continuously in "SimpleBLEPeripheral_performPeriodicTask()" function which will loop and transfer all data in one connection?

Regards

Dulip

  • Hello Dulip,

    Welcome to BLE!

    BLE doesn't define a data exchange profile service, hence you must define your own custom GATT service. The Simple Profile (i.e., what simple_peripheral implements) might not be the best profile for doing this. One way you could do this is by doing a read of ATT_MTU-1 bytes (max from a ATT Read) of a characteristic. You could use another characteristic to tell (ATT Write) the peripheral which "index" of data you will read next.

    I suggest starting with our SimpleLink Academy labs for BLE fundamentals and custom profiles. You can find a link in the pinned Getting Started FAQ.

    Best wishes
  • Hi JXS,

    I found a way to transfer large set of data ( 100Byte x 1000) as follows. Can you follow up and tell me is there any problem in that.

    I use cutom characteristic 5 in simple_peripheral example. In default it is defined to sent 5bytes (1, 2, 3, 4, 5) in SimpleBLEPeripheral_init() funtion. So when I read it by BLE scanner Android app the value shown is 0x0102030405.
    What I did was increase the customs.characteristic.5 value length upto 100. (it was limited to 63. But when I increase MAX_PDU size to 250 (max is 255) I was able to increase the length to 100 or upto 255). In the init() funtion characteristic 5 value , I set 100 zero. {0, 0, 0,.............0}. Inside the SimpleBLEPeripheral_taskfxn() function in SimpleBLEPeripheral_performPeriodicTask() function I set charValue5 array in variables (x1, x2, x3......, x100) (which were declared as local variables at the top of the simple_peripheral.c file) use Simple_SetParameter() which will set the variable in the service characteristic and increment the variable in every loop by one. When I observe this on BLE Scanner. Each time I press "R" in custom characteristics 5 I can see it increment in every 5 seconds (which is the loop interval that I can change by changing SBP_PERIODIC_EVT_PERIOD).


    In my view this can be use to transfer a large data set which is saved in the flash. For example like in the format of 1000 of 100byte frames. Is this right? What are the limitation of this method?


    Thank you in advance. hope your reply soon.
    Dulip
  • Hi JXS,

    Any updates on this.

    Dulip
  • Hi Dulip,

    You would need to confirm the actual ATT_MTU size before setting the data or know how much was read. Doing a timer may not be robust, what happens if the phone misses a read?

    Best wishes
  • Hi JXS,

    So you mean even though I would be able to sent data in a higher byte rate from the CC2640R2F, from the receiver side (Apple iPhone) it won't read them all.

    Is this the correct thinking - The sending data rate should be less than or equal to the baud rate of the receiver?

    Thank you very much
    Dulip

  • Hi JXS,

    Any idea.

    Dulip
  • Hi Dulip,

    I can't provide an answer - I recommend prototyping this solution and using a sniffer to assist in the verification. I think you have enough to get started. Looking forward to seeing your results.

    Best wishes