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

BLE UART losing packets

Hi all,

I am using PCA10040 with nRF5_SDK_13.0.0 and using the ble_perpheral -> ble_app_uart example.

I am trying to stream data from UART to an android phone and the data is coming from an external MCU with its TX/RX pin connected to the RX/TX pin on the NRF52DK. Every 40ms, I am sending a line of characters up to 49 bytes (max), terminating with a new line character.

Somehow, the android app is not able to receive the data and it only able to receive 1 out of every 3 lines of characters, and this is very consistent. Here is the log file from the app:

10:12:52.531 "4 111 222 333 211564 212372 212076 999999 0" received I 10:12:52.550 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 37-09-31-31-31-09-32-32-32-09-33-33-33-09-32-31-31-35-30-37-09-32-31-32-34-30-33-09-32-31-32-30-36-34-09-33-32-36-34-35-09-30-0D-0A

10:12:52.572 "7 111 222 333 211507 212403 212064 32645 0" received I 10:12:52.596 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 31-30-09-31-31-31-09-32-32-32-09-33-33-33-09-32-31-31-35-31-35-09-32-31-32-33-33-31-09-32-31-32-30-38-31-09-33-32-33-30-30-09-30-0D-0A

10:12:52.621 "10 111 222 333 211515 212331 212081 32300 0" received I 10:12:52.643 Notification received from 6e400003-b5a3-f393-e0a9-e50e24dcca9e, value: (0x) 31-33-09-31-31-31-09-32-32-32-09-33-33-33-09-32-31-31-35-32-30-09-32-31-32-33-36-36-09-32-31-32-30-34-34-09-33-32-33-31-31-09-30-0D-0A
A 10:12:52.662 "13 111 222 333 211520 212366 212044 32311 0

It basically receiving the 4th, 7th, 10th line etc, and losing the 5th, 6th, 8th, 9th etc lines. Can anyone advise on how this problem can be solved?

Thanks in advance!

Parents
  • Are you checking the returned error code of ble_nus_string_send()? Is it always NRF_SUCCESS (0x00000000)?

  • Seems you are checking the error code, if err_code was something else than NRF_ERROR_INVALID_STATE or NRF_ERROR_BUSY you would enter the error handler and reset the device (if you haven't defined DEBUG).

    If ble_nus_string_send() is called successfully the notification should be buffered, so then the issue may be on the Android side, but it is a but difficult to say without debugging some more. The easiest way to find out is to do a sniffer trace of the connection, you can use the nRF Sniffer. If that is not possible, I would add some more printfs, to see that you don't get disconnected or something like that.

    You could also try to do a test by connecting to another DK, running the ble_app_uart_c example, see if you are able to receive everything there.

Reply
  • Seems you are checking the error code, if err_code was something else than NRF_ERROR_INVALID_STATE or NRF_ERROR_BUSY you would enter the error handler and reset the device (if you haven't defined DEBUG).

    If ble_nus_string_send() is called successfully the notification should be buffered, so then the issue may be on the Android side, but it is a but difficult to say without debugging some more. The easiest way to find out is to do a sniffer trace of the connection, you can use the nRF Sniffer. If that is not possible, I would add some more printfs, to see that you don't get disconnected or something like that.

    You could also try to do a test by connecting to another DK, running the ble_app_uart_c example, see if you are able to receive everything there.

Children
No Data
Related