peripheral_uart sample not working as expected

I’m trying to set up a simple relay using an nRF52840 board to route data between a BLE central (my phone) and a 9600bps UART device. My goal is to send data from the phone to the nRF52840, which should relay it through the TX pin. Meanwhile, any data received on the RX pin should go back to the phone via BLE.

From what I’ve read, the peripheral_uart example should handle this. I connected pins P0.08 and P0.06 with a patch wire, expecting that anything I send would loop back and appear in the "Bluetooth Low Energy" app in nRF Connect for Desktop. (I also have an nRF52 USB dongle connected for communication with my PC.) However, I’m not seeing any data being received.

Does anyone know what I might be missing or misconfiguring? Any help would be greatly appreciated.

Thanks!

I created a new application using the peripheral_uart sample in VSCode with the nRF Connect extension, then built and flashed it onto my nRF52840 DK without any issues. Afterward, I connected pin P0.08 to P0.06 with a jumper wire.

Using the Bluetooth Low Energy app in nRF Connect for Desktop, I connected to the device labeled "Nordic_UART_Service," which shows a UART-over-BLE service. Within that service, I can see the UART TX and UART RX characteristics. My expectation was that anything I send through the TX characteristic would loop back to the RX characteristic. However, I'm not seeing any data returned on RX.

I'm using the latest SDK 2.9.0

  • Hi,
    Could you tell me whether you get the same behaviour with another version of the SDK, say, v2.7.0?

    Also, do you have the hardware flow control disabled?

    Have you tried changing the baud rate to say, 115200?

    Regards,

    Priyanka

  • Hi Priyanka,

    Thank you for your response!

    I have now built the sample with SDK 2.7.0 and set the baudrate in the app.overlay to:

    uart0 {
    current-speed = <9600>;
    };

    as 115200 was the default.  Do I need to explicitly disable hardware control flow? How do I do that? I can send data on the Nordic_UART_Service and I can confirm that something was received on the RTT shell displaying messages from my device.

    But I still have the loopback between pins P0.06 & P0.08 connected but it doesn't look like any data is coming back to my nRF Connect software after I send data. I'm sending four Bytes:

    12 34 56 78 from RX UART

    and I hit the play button on UART TX  but I cannot see anything coming back. Why not?

  • Hi,

    Apologies for the extremely delayed response. I got held up with another case and this went off the queue.

    Could you tell me why you are trying to connect the TX and RX together?

    After building and flashing the usual peripheral_uart sample, if you connect to the Nordic_UART_Service as mentioned earlier, then you will be able to see the communication between the phone and the DK via the TX and RX options on your phone.

    Or is this not working?

    Regards,

    Priyanka

Related