I have two nrf51822 modules and first one is sdk8.0.0 / s110 / peripheral device, second one is sdk10.0.0 / s130 / central device. I've sent a 10-character data array like ""0123456789" with use peripheral device. In the other module I am trying to retrieve it and store it in the nus_data array. I can send 10-character data array with use peripheral device but I can not store the data in the central device .
I defined nus_data to store handling uart data received over BLE
uint8_t nus_data[12] = {0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
And I tried to use "ble_nus_c_evt_handler" function to get data over BLE.
static void ble_nus_c_evt_handler(ble_nus_c_t * p_ble_nus_c, const ble_nus_c_evt_t * p_ble_nus_evt)
{
uint32_t err_code;
switch (p_ble_nus_evt->evt_type)
{
case BLE_NUS_C_EVT_FOUND_NUS_TX_CHARACTERISTIC:
APPL_LOG("The device has the device TX characteristic\r\n");
break;
case BLE_NUS_C_EVT_FOUND_NUS_RX_CHARACTERISTIC:
err_code = ble_nus_c_rx_notif_enable(p_ble_nus_c);
APP_ERROR_CHECK(err_code);
APPL_LOG("The device has the device RX characteristic\r\n");
break;
case BLE_NUS_C_EVT_NUS_RX_EVT:
for (uint32_t i = 0; i < p_ble_nus_evt->data_len; i++)
{
while(app_uart_put( p_ble_nus_evt->p_data[i]))
{
nus_data[i+2] = p_ble_nus_evt->p_data[i];
}
}
break;
case BLE_NUS_C_EVT_DISCONNECTED:
APPL_LOG("NUS device disconnected\r\n");
// scan_start();
break;
}
}
But I can not store p_data into the nus_data array. Do you have any suggestion to store nordic uart data over BLE ?