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: How to send some amount of bytes in GATT message

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640,

Hi,

I'm working on cc2640r2 board. I can able to connect with central device with my peripheral coded device. I m working in SDK 2.20 in ccsv10 

Also with Android device, in ble scanner can able to write/read characters and can see the serial data in log UART. 

The problem is how to make central device in Linux machine other than same cc2640 and connect with my peripheral cc2640 device and transfer 4to 6 bytes of data.? I couldn't able to find it porting document. Is there any way send data ?like read and write.

Thanks in advance

  • I suppose you can refer to how simple_peripheral example implements characteristic 5 which can be used to send 5 bytes array data.

  • Yikai Chen,

    I agree your answer. I can read or write between the two cc2640 devices. But I don't know how to data transfer of char5( you mentioned above) with Linux based system like Linux is GATT server and cc2640 is peripheral device.

    As of now, I can connect with my cc2640 device with Linux system like pi. But I couldn't transfer data to cc2640 which is saying FC violated:2 and only displaying MTU size:65.

    I know that data should transfer with GATT attribute message protocol like handle, uuid, permission value. But I couldn't find anything in Linux system . Can you help to resolve it? Do you know to transfer the data from Linux system to cc2640 with GATT attribute message? What is the connection handle value? And what is the command value we should give to let cc2640 accept ?

    I'm mean syntax . In python or any platform, can you show the template or sample program that transfer data from Linux device to cc2640 peripheral? Need an example to understand and proceed. That would be easier

    So thanks. In advance
  • Hi Rahman,

    I'd like to clarify the use case here. Here are the two configurations that I'm confused with:

    • Do you want to connect a second CC2640R2 to a linux machine and use the linux host to send data to your CC2640R2 peripheral?
      • If this is the case, you can use host_test project example to send HCI commands to the peripheral. Here, you would connect the CC26240R2 to the linux machine and send commands to the CC2640R2 through UART. We use BTOOL for this, however this is only a Windows tool so you will have to send commands yourself via UART.
    • Or do you simply want to use a linux machine without a second CC2640R2 connected to send data to a CC2640R2 perhiperhal?
      • If this is the case, you would need your linux machine to have a radio. Then, you can use something like Zephyr's open source Bluetooth stack to use your linux machine as a central.

    Hope this answers your questions. Unfortunately we don't have an example specifically for linux, but the host_test SDK example in combination with BTOOL should give you a good starting point to create what you're looking for.

  • Thank You Ammar for the clarifications. Can you please explain the reason for the following scenarios

    1. I have used the bluepy module in Linux system to connect to my simple  peripheral coded CC2640R2F board. After connected to the CC2640R2, in device serial saying that MTU size is 65. what is this mean? I know it is Maximum transmission protocol. But the point is, this 65 value could not be changed by me. 

    2. With the help of Bluepy module, the function called write characteristics( handle, command, permission). transfer by using handle id. i could not receive data by this method. What could be the reason?

    Thanks in Advance

  • Hey Rahman,

    Unfortunately I am not an expert on the Bluepy module. To briefly answer your questions:

    1. The MTU size is negotiated upon a connection, and is usually decided by the central device (while the preferences are set by the peripheral, the central has the final say). On the peripheral side, please review our User's Guide. Specifically, our MTU section.

    2. Again, I'm not an expert here. You will have to ensure you succesfully connect to the peripheral, then run characteristic discovery process to identify all the characteristics you can write to. Then, you should have the information you need to write the characteristic. There is some discussions here and here about this after a quick Google search.