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

Why too much data is lost when there is 11 peripheral connected to 1 central via NUS connection

Hello, I have a big problem now. I set up a BLE network with 11 peripheral boards connected to 1 central board via NUS protocol. the peripheral board is based on NRF52840 and the central board is NRF52840 DK board. The peripheral board read the sensor at 50Hz and 16 bytes per reading. Every 14 readings, the sensor board will send the data as s packet to the central board, and the central board transfers data to the laptop via the UART port. When there is only one peripheral, it is fine.

But when the peripheral boards increase, the data will be lost and most data cannot transfer to the laptop. What causes the problem? Thanks. Any help will be appreciated.

Parents
  • Hi,

    You are sending quite long packets (sensor data per packet is 16 byte * 14 readings = 224 byte), so it takes a bit of time on air. Ignoring any overhead and just looking at sensor data this is about 9 kbps with 11 peripherals ,which in itself is not too much. However, the central will need to schedule time for all connections. Depending on connection parameters and number peripherals the SoftDevice scheduling may be difficult. You can see more about SoftDevice scheduling here, and specifically Connection timing as a Central is relevant.

    With your fairly low total data rate you should be able to get everything through with sensible connection parameters. Which connection parameters do you use? It may make sense to send less data more often, using shorter event lengths and shorter packets. That way each connection can exchange data more frequency and you can add some margin for retransmissions (which will happen more seldom with shorter packets).

  • Hi Einar, I have change the and NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL to 11 * NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL but there are many reconnection during the transferring. I am wondering if I should change the 

    #define MIN_CONN_INTERVAL MSEC_TO_UNITS(10, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
    #define MAX_CONN_INTERVAL MSEC_TO_UNITS(1900, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */

    two parameters as same as in the central board? Thanks.

  • Hi,

    As you are making both sides it makes sense to set the same value as min and max on both sides. Also, make sure that the interval is long enough. Compared to connections and event length If you have an event length of 2.5 ms (NRF_SDH_BLE_GAP_EVENT_LENGTH set to 2 in both peripheral and central) and you have 11 peripherals then you should have at least 2.5 ms * 11 + time for advertising, so it makes sense with no less than 30 ms connection interval.

    Regarding the disconnects I do not know why you disconnect. is it because of an error check is hit when buffers are full? If so, it might be that you should look into the possibility to reduce the amount of data you need to transfer.

Reply
  • Hi,

    As you are making both sides it makes sense to set the same value as min and max on both sides. Also, make sure that the interval is long enough. Compared to connections and event length If you have an event length of 2.5 ms (NRF_SDH_BLE_GAP_EVENT_LENGTH set to 2 in both peripheral and central) and you have 11 peripherals then you should have at least 2.5 ms * 11 + time for advertising, so it makes sense with no less than 30 ms connection interval.

    Regarding the disconnects I do not know why you disconnect. is it because of an error check is hit when buffers are full? If so, it might be that you should look into the possibility to reduce the amount of data you need to transfer.

Children
No Data
Related