Hello.
I have a question. I use nrf52 & Keil. I want to get data from sensors and send it with BLE.
Now, I found sample codes. It uses UART and sends with BLE.
Is there code or way of send data with BLE without UART?
Thanks,
Hello.
I have a question. I use nrf52 & Keil. I want to get data from sensors and send it with BLE.
Now, I found sample codes. It uses UART and sends with BLE.
Is there code or way of send data with BLE without UART?
Thanks,
So in BLE, you send data over Services and Characteristics. There are tutorials here that can help you get start with those concepts.
The example that send data using UART you mentioned is probably the UART/Serial Port Simulation example. It use the Service "Nordic UART Service" and the two Characteristics "TX" and "RX" to transfer data.
If you want to see how to transfer data via the same Nordic UART Service, look at the function uart_event_handle()
. You could see that data receive over UART is stored in data_array
and send using ble_nus_string_send()
.
If you want to see how to transfer data via some other standard BLE Service, you can look at the Health Thermometer Application. In this one, you can find Battery state and Temperature data is simulated via the Sensor Data Simulator and send through the Battery Service and Health Thermometer Service in battery_level_update()
and temperature_measurement_send()
There are a few more where they send simulated data over other BLE Services. However I am not aware of any stock nRF5 SDK example that use actual sensor data and send data using any BLE Services.
I don't know which SDK version you are using so I provided links to documentation of SDK v10.0.0. But there should be similar articles in the version of the SDK you are using.
As @Võ Thanh Hiêu says, the health thermometer application, or any other example shows how to transmit data. The functions battery_level_update(..) and temperature_measurement_send(..) both show how to transmit data from a server to a client. To update data from a server to a client, the function sd_ble_gatts_hvx(..) is being used.
As @Võ Thanh Hiêu says, the health thermometer application, or any other example shows how to transmit data. The functions battery_level_update(..) and temperature_measurement_send(..) both show how to transmit data from a server to a client. To update data from a server to a client, the function sd_ble_gatts_hvx(..) is being used.