peripheral_uart sample - sending data over BLE

Hi. I am executing the peripheral_uart sample on an nrf5340 audio kit.

I can send data successfully from the  nRF Connect app over BLE to an nrf5340 audio kit, using the NUS RX characteristic, received in the kit ap via the callback bt_receive_cb

I am struggling a bit with how to send data the other way, from the kit back to the nRF Connect via the NUS TX characteristic.

I would like to send application data as strings from the kit back to the nRF Connect app and have it displayed via the TX characteristic on the app. Not user-entered data, but application data.

Which APIs can I use? It's immediately obvious. Thanks in advance 

Parents
  • Hi Pablo, 
    You can send data from the nRF53 to the phone by calling bt_nus_send(). This will send a notification with the data  you provided in the function. 
    In the code in  peripheral_uart we call this function in a infinite loop checking for any data in the UART buffer. 

    On the phone's side please make sure you have enable notification on the RX characteristic. 

Reply
  • Hi Pablo, 
    You can send data from the nRF53 to the phone by calling bt_nus_send(). This will send a notification with the data  you provided in the function. 
    In the code in  peripheral_uart we call this function in a infinite loop checking for any data in the UART buffer. 

    On the phone's side please make sure you have enable notification on the RX characteristic. 

Children
Related