Hi, I'm using nrf51822 and ble_app_uart(SDK 12.3.0)
What I want to do is connect my board with nrf51822 and send data over UART
and send data to smartphone over BLE
UART data comes about 50bytes/sec
My problem is BLE connection is keep disconnected.
Actually, Hard to connect BLE at first. Sometimes do, Sometimes don't.
When it connected fortunately, It will disconnected soon.
Disconnecting time is unpredictable.
Sometimes smartphone receive data, sometimes don't.
I didn't changed sample code.
I'm new BLE, please help me..
Thanks!
void uart_event_handle(app_uart_evt_t * p_event){
static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
static uint8_t index = 0;
uint32_t err_code;
switch (p_event->evt_type)
{
case APP_UART_DATA_READY:
UNUSED_VARIABLE(app_uart_get(&data_array[index]));
index++;
if ((data_array[index - 1] == '\r') || (index >= (BLE_NUS_MAX_DATA_LEN)))
{
err_code = ble_nus_string_send(&m_nus, data_array, index);
if (err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}