-
Hi, I am hoping someone more familiar with the Adafruit Bluefruit52Lib (and BLE in general) can assist me. I am working on a project with a nrf52840 feather device as the master/central and I have a BLE capable slave/client device that provides its information/data over a bluetooth serial link. I am using the Arduino2 IDE for writing my code and programming the nrf52840. I have read through the Adafruit documentation and examples and have succeeded in sending and receiving data based on the Adafruit examples and the information provided to me by the device manufacturer. The problem I am seeing is that all return serial data being received by the central nrf52480 is only being received because the connection has ended and the slave device has flushed the serial data before disconnecting. To summarise the steps in my code, I have setup a BLEClientDis, a BLEClientService, and a BLEClientCharacteristic. My 'setup' begins with Bluefruit.begin(0,1), then I .begin() the client discovery and the BLEClientService for the serial link. Next, I configure the .setNotifyCallback(my_rx_function) for the BLEClientCharacteristic and .begin() it. I set up the main connect_callback and disconnect_callback functions, as well as the scanner ones. Everything so far is based on the examples. Once the device is discovered and the serial link service is also discovered I set the .enableNotify() on the serial link. I then write some bytes to the serial link, which should cause the slave device to respond very quickly. Instead the device does not return anything until the nrf52840 initiates a disconnect and receives the flushed serial data, which should have been received immediately. I believe the reason this is happening is because there is a step missing from the set up, which the manufacturer has provided, but which I do not know how to execute using the Bluefruit52Lib. They say that when the .enableNotify() is called, I must also write 0x0001 to the descriptor 00002902-0000-1000-8000-00805f9b34fb. However, I do not know how to set a descriptor value and could not find any examples; my understanding is that a descriptor is different from a characteristic. I know that this descriptor exists because I can use bluetoothctl on the Linux command line to obtain the slave device's information and this descriptor appears alongside the serial link characteristic for the slave device. I think that once this descriptor is set correctly, the serial data will flow back to my nrf52840 in a timely fashion. I hope someone is able to assist with this. Let me know if I have not provided enough information. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I believe this issue has been resolved, and there is no need to set the descriptor (or this is actually taken care of within the library code). I have discovered that the slave device is expecting specific line return sequences before it responds. I have now determined what these are and the responses are arriving much more quickly. |
Beta Was this translation helpful? Give feedback.
I believe this issue has been resolved, and there is no need to set the descriptor (or this is actually taken care of within the library code). I have discovered that the slave device is expecting specific line return sequences before it responds. I have now determined what these are and the responses are arriving much more quickly.