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

BLE_APP_UART example not working properly.

Hello everyone, I am very new to nRF52832 Development Kit and was testing some examples to get familiar with this kit, however i encountered an issue while testing the ble_app_uart example.
I followed the instructions provided by nordic infocenter line by line.
My configuration settings are


Baud rate : 38400

Com Port : COM6 (verified through device manager)

flow control : disabled

parity none, 8 data bits, 1 stop bit

and I am using termite.

The issue that i encountered and could not resolve although i tried a lot is that my nRF toolbox or nRF connect app is not able to receive anything which i send from the termite towards the phone. However if i send any character from the phone, it's received and displayed at termite windows perfectly. So what basically is the problem? Why i can receive data from toolbox or connect app but can't transmit data towards them. Please help me out. Thanks

Parents Reply Children
  • Hello, did you enable notifications on the TX characteristic? nRF connect must enable notifications in order to receive notifications from the peripheral. In addition, the app will buffer UART data until it reaches "m_ble_nus_max_data_len" number of bytes or until it receives a newline ('\n') , then send the notification packet. In other words, notification will not be sent if you only write "Hello" without terminating it with a newline.  

     You could try to replace '\n' with '\r' In case the serial client doesn't append a newline to the text string. With this change you should see that the notification gets sent as soon as you press enter

    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 >= (m_ble_nus_max_data_len)))
                {
                    NRF_LOG_DEBUG("Ready to send data over BLE NUS");
                    NRF_LOG_HEXDUMP_DEBUG(data_array, index);
    
                ...

  • I had done everything as you have mentioned here sir. Dont know what the actual reason of the problem was, but now transmission and reception and working perfectly great. Dont know what happened or how it happened but suddenly the example is running perfectly. Thank you so much for your time sir.

Related