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

nrf52832 ble_uart project - sending all data received on uart over BLE

Hi

I have problem because i dont get all data which are in FIFO uart  on my smartphone via BLE. Nrf as i can see in example sends data where data[index-1] == 0x0d || data[index-1] == 0x0a.

Becase not all message which nrf52832 get via uart ending with 0x0d or 0x0a i dont receive on my smartphone.

I want that every byte nrf52832 get on uart it sends over ble. I have tried with smaller buffer and changing/adding conditions in 

 switch (p_event->evt_type)
    {
        case APP_UART_DATA_READY:
            UNUSED_VARIABLE(app_uart_get(&data_array[index]));
            index++;

            if ((data_array[index - 1] == '\n') ||
                (data_array[index - 1] == '\r') ||
                (index >= m_ble_nus_max_data_len))
            {
                if (index > 1)
                {
                    NRF_LOG_DEBUG("Ready to send data over BLE NUS");
                    NRF_LOG_HEXDUMP_DEBUG(data_array, index);

                    do
                    {
                        uint16_t length = (uint16_t)index;
                        err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle);
                        if ((err_code != NRF_ERROR_INVALID_STATE) &&
                            (err_code != NRF_ERROR_RESOURCES) &&
                            (err_code != NRF_ERROR_NOT_FOUND))
                        {
                            APP_ERROR_CHECK(err_code);
                        }
                    } while (err_code == NRF_ERROR_RESOURCES);
                    
                }

                index = 0;
            }
         
            break;

        case APP_UART_COMMUNICATION_ERROR:
            APP_ERROR_HANDLER(p_event->data.error_communication);
            break;

        case APP_UART_FIFO_ERROR:
            APP_ERROR_HANDLER(p_event->data.error_code);
            break;

        case APP_UART_TX_EMPTY:
          
  

        default:
            break;
    }

but nothing help with that. When messages are ended with 0x0d 0x0a i dont see on my smartphone 0x0a.

Related