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

UART bytes error in ble_app_uart examples

Hi!

I'm trying to pass the BLE data to the PC using nrf52840 DK.

To do so, I've started with the ble_app_uart example and it was able to build fundamental features–find BLE device, get BLE notification, and send to PC via FIFO.

But the problem is that 1) a lot of data are missing during the UART procedure and 2) throughput seems to be lower than what I expected.

It was able to get a clean result with a low BLE data transmission rate (32k bps) and a low UART baud rate (115200).

The BLE data rate should be at least 10 times higher (320k bps, and 640k bps for the ideal). It means that I need to increase the UART baud rate to more than 460800.

But when I increase the baud rate to more than 230400, the data become weird.

For example, when I check the BLE packet with the nRF Connect application, a repeated 30-C8 (00110000-11001000) appears. But the UART result is 91-E8 (10010001-11101000).

This is quite a huge problem for me because all the bytes are in the form of 00xxxxxx-11xxxxxx.

Fortunately, in the case of the 460800 baud rate, this happens very few times but for the 921600 baud rate, the error becomes the major.

I may build my applications with the 460800 baud rate, but I want to be sure why this happens and whether I can solve the problem. Is there any related information?

Also, I'm curious whether the hardware flow control is working... 

I turned on the flow control option by changing NRFX_UARTE_DEFAULT_CONFIG_HWFC, NRFX_UART_DEFAULT_CONFIG_HWFC, UART_DEFAULT_CONFIG_HWFC to 1 but it seems there is no difference with those options are turned off.

P.S. I found the usbd_ble_uart example, but what is the advantage of using CDC ACM USB? Is there any performance improvement than JLink CDC UART port?

Parents Reply
  • Normally when sending data on UART the start bit is used to "synchronize" the receiver for every byte, if you send large amount of data back-to-back, and if there is some difference on the baud rate between the transmitter and receiver (due to error in the baudrate generator or clock), this may after some time lead to issue with the synchronization, and thereby errors in the data. Adding some delays between bytes and/or some delay (e.g. 10us) every 100bytes can help in such situation. Maybe you are able to experiment with that?

    I have also seen that the SEGGER chip on the nRF DK in some situation is not very tolerant to UART "variations", so it could be that you should try to get a proper FTDI UART to interface to the nRF52840 instead.

    If you have access to a logic analyzer that may also help to check the baudrate and data flow.

Children
Related