This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Setting up a bidirectional data flow between two nordic devices

Hi all, i recently posted some topics about my application to receive support, everything went good but now i need to add a last step to the project, and i would like to have some advices. Resuming briefly: i have a smart beacon kit (rev 1.0 with s110 and sdk 7.1) that converts data from a sensor with the ADC, and every value is sent to an nrf51 DK (that acts as central), connected to my PC via USB, to visualize these values on Matlab. This transmission works fine, i have a custom service on the beacon (not the ble_nus since it's not available for this device and revision), and the nus service on the DK (the example ble_nus_c properly modified for my application); i perform db_discovery on the DK to find the custom service of the beacon, after getting the two devices connected, and i correctly receive the values on Matlab.

Now i want to perform also the opposite operation, send data FROM Matlab to my beacon, and store them in his memory. The whole project needs this bidirectional flow of the data! Since i have the ble_nus_c on the DK, if i understood correctly, it is ready to send via BLE any number that i type in Matlab (using fwrite with the serial port open), but my question is: how i can manage the beacon to successfully receive this value (that is sent as a notification in Ble_nus_c right?) and store it in a variable? Do i have to do db discovery again or since the two are already connected and some data is being sent in one direction there is a simpler way?

Thanks in advance for every help!

Parents
  • Sorry i was wrong, in the code that i use on the DK, it actually uses sd_ble_gattc_write function to send FROM the DK to the beacon! So it is the same that you are saying. So in order to receive the values, i only have to add a characteristic in the code of the beacon? My service on the beacon has just a characteristic that is the one with the data converted by the ADC, and of course with his CCCD configured to sent the value by notification to the DK. So how should i do to get it ready to receive the "write" data from the DK?

Reply
  • Sorry i was wrong, in the code that i use on the DK, it actually uses sd_ble_gattc_write function to send FROM the DK to the beacon! So it is the same that you are saying. So in order to receive the values, i only have to add a characteristic in the code of the beacon? My service on the beacon has just a characteristic that is the one with the data converted by the ADC, and of course with his CCCD configured to sent the value by notification to the DK. So how should i do to get it ready to receive the "write" data from the DK?

Children
No Data
Related