BLE NUS receiver buffer not cleared completely

Hi

I am working on a custom BLE NUS using the ble nus peripheral example. I am currently using bluez on a linux machine as client and a nrf52840 dongle as server. I can send and receive messages just fine but the receive buffer on the dongle is not clear completely.

First message was 'sample 10' and the second message was 'sample 4', sent from the linux machine. However the dongle received 'sample 40' instead of 'sample 4'. I tried clearing the buffer but nothing works.

Parents
  • Hi,

    There are numerous ways this could happen, depending on the underlying APIs, string formats, the way you print the strings, buffers used, etc.

    I suspect this to be related to different ways of handling strings and buffers: Some combination of reusing buffers, strings or buffers where you need to keep track of length acutally used, and c style (null terminated) strings. However, in order to tell what is going on, I need full details of code receiving, handling, buffering and printing the strings.

    What SDK, version and exact example are we talking about, and what changes (if any) have you done to it?

    Regards,
    Terje

Reply
  • Hi,

    There are numerous ways this could happen, depending on the underlying APIs, string formats, the way you print the strings, buffers used, etc.

    I suspect this to be related to different ways of handling strings and buffers: Some combination of reusing buffers, strings or buffers where you need to keep track of length acutally used, and c style (null terminated) strings. However, in order to tell what is going on, I need full details of code receiving, handling, buffering and printing the strings.

    What SDK, version and exact example are we talking about, and what changes (if any) have you done to it?

    Regards,
    Terje

Children
No Data
Related