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

How to send the data from central to peripheral

Hi,

I am using the nrf51422 controller and other controller which contains Bluetooth .The nrf51422 Bluetooth is central and other controller Bluetooth is peripheral.I am using SDK 12.3 in which i am using ble_central\ble_app_blinky for nrf51 422 Bluetooth .I have tried this example program so the nrf51422 bluetooth is paired with other controller bluetooth by changing the device name in example program instead of "nordic_blinky" to my device name.So as of now it is paired now i need to send the data from the nrf51422 to peripheral  bluetooth so in this example program the data  send function is not there .so i have included the send function in this example program here the problem is data is not sending to peripheral.can you tell me what is the problem.

I thought of using ble_central\ble_app_uart program .In this program the Bluetooth is connecting based on the uuid of the device.Here i don't know what  is the uuid of the peripheral  Bluetooth

so i have tried this  example  ble_central\ble_app_blinky.Soplz can you tell me how to send the data.

void send_ble_data(uint8_t * p_data, uint16_t length)
{
static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
memcpy(data_array, p_data, length);
ble_nus_c_string_send(&m_ble_nus_c, data_array, length);
NRF_LOG_INFO("sent.\r\n");
}

Parents Reply
  • You can use the nRF connect app android or iOS to inspect the advertisement packet from your peripheral. For instance, check if it includes any UUIDs that you can filter on. When you have done this you can configure the Scanning Module to filter on one or more of its parameters. It is possible to only filter on the device name for instance.

    However, this will only let you find the correct device to connect to, you still to implement a GATT client to access the various characteristics on your server. You may use UART client as a starting point and adapt it to the services you have on the peripheral.  

Children
Related