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

BLE lost messages

Hi, as part of my project i have 2 nordic 52dks one as a pheripheral (sending) and on as a client (recieving). where i am sening a buffer of 8, in the order

buffer[0] = 10

buffer[1}= X gyro lsb

buffer[2] = X gyro msb

buffer[3] = y gyro lsb

buffer[4] = y gyro msb

buffer[5] = z gyro lsb

buffer[6] = z gyro msb

buffer[7] = 36   //terminator $

however sometimes i seem to lose a byte over ble such that the next byte received will be less and hence the order is correupted thus making processing rather and unpredictable for a large sample size like 1000000 samples.

how may i ensure that my ble settings are correct such that i ensure to limit this issue.

my code was based of the examples ble_app_uart and ble_app_uart_c for the peripheral and client respectivly.

thank u in advance 

Parents
  • Hello,

    however sometimes i seem to lose a byte over ble such that the next byte received will be less and hence the order is correupted thus making processing rather and unpredictable

    No byte is lost over the BLE link, it is not possible as the protocol uses the CRC field to verify that the contents of the packet is uncorrupted and received as it was sent. If the CRC does not match, the packet is discarded and not acknowledged - leading to a re-transmission of the same packet.
    If you would like to confirm the communication happening on-air between the devices you could use the nRF Sniffer tool to trace the communication and read the individual packet contents.

    How is your handling / processing of the received data? How are you alerted to the seemingly corrupted data? Have you checked whether the corrupted values could be what the peripheral intended to send?

    Looking forward to resolving this issue together!

    Best regards,
    Karl

  • Firstly i would like to thank you for your reply, and for the sniffer, is there any documentation on how to install this please?

    The way im checking that the data is being missed is through the uart terminal of the client (recieving) board and also i have a matllab script that is reading serially aswell. to check this i sent known data meaning sending 8 bytes (hex) 10-16 and a terminator 36.

    and as u can see in the first colomn its fine but then in the second colom the 12 didnt send or be recieved which will therefore mess up my data 

  • NikTheNordicUser said:
    also the way that i am sending the data is as follows

    I cant see anywhere that you are checking what the returned error code of the ble_nus_data_send function is. This is what I suspected in my previous comment, I should have been more explicit.
    Please add an APP_ERROR_CHECK(err_code) following your call to ble_nus_data_send, to see if the call succeeded.

    Please also ensure that you hade DEBUG defined in your preprocessor defines, like shown in the included image.


    This will print a detailed debug message to your logger, if a non-NRF_SUCCESS error is passed to an APP_ERROR_CHECK.

    Please make sure to always check your returned error codes. If there are other places in your code where you are not checking them, please go back and add an error check.
    The returned error codes are critically important to understand issues during development, and for handling run-time errors when the application is deployed.

    Please do this, and let me know what is printed to your logger when the issue occurs.

    Best regards,
    Karl

  • hi i just added the app error check but now the 2 dev kits arent connecting together. it only connects when the app error check is commented out

  • Have you added the DEBUG preprocessor defined like I asked in my previous comment? Have you checked your logger output when this happens? - if so, what does it say?

    Your device is likely restarting because it is hitting an error somewhere. Resetting the device is the default error handing.

    Best regards,
    Karl

Reply Children
  • Great! Thank you for confirming.

    Karl Ylvisaker said:
    Have you checked your logger output when this happens? - if so, what does it say?

    Are you seeing anything in your logger when the device suddenly resets?
    If so, please tell me what the logger says.

    Best regards,
    Karl 

  • hi , no i dont get anything in the logger, and as mentioned previously my client devboard doesnt connect to the perhiperal with the app error

  • is it possible to have some kind of meeting please? inorder to solve the issue please and also ask some minor questions with relation to this ticket please

  • NikTheNordicUser said:
    hi , no i dont get anything in the logger,

    Which logger backend are you using, and how have you configured it?
    Are you working out of an example from the SDK? If such, the example should have the logger setup already, so that you see output in your logger when starting any unmodified SDK example.
    These logs usually read something like ".... example started".

    If you are working out of the ble_app_uart example, the example uses the RTT logger backend by default. You will then only see the messages either in the SES debug terminal or using an RTT terminal such as Segger's RTT Viewer application. 

    NikTheNordicUser said:
    as mentioned previously my client devboard doesnt connect to the perhiperal with the app error

    This is likely due to a non-NRF_SUCCESS error being passed to an APP_ERROR_CHECK.
    While it may seem like a step in the wrong direction, it is actually a crucial step in the right direction, as this alerts you to the fact that a function call in your application is failing - and must be looked closer at.
    Without checking error codes you are only hiding potential problems in your application, and it will most likely cause major headaches later in your development/deployment to leave these unchecked.

    NikTheNordicUser said:
    is it possible to have some kind of meeting please? inorder to solve the issue please and also ask some minor questions with relation to this ticket please

    I do not think a meeting is necessary at this point. We have specific lead to follow to continue the debugging - seeing the logs in order to understand what part of the application is failing. My suspicion here is that your call to ble_nus_data_send fails with the NRF_ERROR_RESOURCES error code. This is however just my suspicion, and we will need the loggers output to know for sure.
    Please write any minor questions you might have here in the ticket - this will keep the forum tidy, and might help other forum-goers who have the same questions later.

    If these minor questions are sensitive or contain sensitive information, you can just let me know and I can mark the ticket as private. This will make the ticket only viewable to your self and the support staff here at Nordic.

    Looking forward to resolving this issue together.

    Best regards,
    Karl 

  • Hi, im using a serial terminal inorder to see the error , however as I mentioned previously when i add the app error check the central dev kit is not connecting to the pheripheral 

Related