BLE GATT Notification Limit - I request 1000 IDs and receive about 408.

I'm developing based on the Nordic Academy example here, but I noticed that when transmitting a large amount of data, something is limiting the amount sent by the NRF52832. I couldn't figure out what is causing this limitation. ( https://github.com/NordicDeveloperAcademy/ncs_handson_videos )

I'm using sensor_data_storage.c to transmit data over Bluetooth, but I can't figure out what's limiting the number of IDs sent. For the data of ID - Unix Timestamp - Temperature - Humidity - Pressure, if I request the last 1000 IDs, it returns about 400 IDs.

I would like to transmit all the IDs I request, up to the maximum available in the 64kB internal flash memory.

Parents
  • Hi Guilherme, 
    Have you tried to use some log to check why only 400IDs is received. I don't see the reason why BLE couldn't transfer more than that.

    I'm not so familiar with the code in the video tutorial but i would suggest to add some log inside send_tail() to tell where the issue is. You can show in the log if the id has been buffered to send to BLE or not. 


    My understanding is the send_tail() function is executed in an interrupt context. Maybe it's not the best practice if you are starting to send thousand of notification. Could you try to do the task in a thread/work instead? 

  • Hi Hung, yes, I tried using logs and prints to understand better.

    I still haven't been able to understand who is limiting this total amount of data transmitted.

    When I request a large number of IDs the program sends several data packets each with around 250 bytes, but there comes a point when it simply stops sending the packets. Why does there come a time when it stops sending even though there is still data left to be sent? I haven't figured it out yet, I don't know if this is an internal layer in bluetooth and I still don't know how to deal with it.

    My next step will be to try to migrate to a thread like your suggestion.

    Thank you very much

  • Hi, 

    Guimodena said:
    When I request a large number of IDs the program sends several data packets each with around 250 bytes, but there comes a point when it simply stops sending the packets.

    As far as I remember it's blocking function when you try to queue BLE packet to be sent. Meaning if the buffer is full, it will be blocked at the function and wait for the data to be sent. Try avoid staying in an event handler for too long. It can cause issue. You should send BLE commands from a thread context. 

Reply
  • Hi, 

    Guimodena said:
    When I request a large number of IDs the program sends several data packets each with around 250 bytes, but there comes a point when it simply stops sending the packets.

    As far as I remember it's blocking function when you try to queue BLE packet to be sent. Meaning if the buffer is full, it will be blocked at the function and wait for the data to be sent. Try avoid staying in an event handler for too long. It can cause issue. You should send BLE commands from a thread context. 

Children
No Data
Related