This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BLE transmission data loss from 5 peripherals to 1 central device

Hi,

I have a configuration of five nRF52840 custom devices transmitting sensor data to a central device (laptop)

The devices can be connected and send data to the central but the central very frequently loses data

coming from the peripherals. This occurs randomly between peripherals during one connection session meaning that data

loss is noticed for example in peripheral 1 and 3 and after lets say two minutes in peripherals 2 and 5.

By saying data loss I mean that in a series of 100 data packets I notice approximately 10 lost packets from a peripheral.

The data loss is verified by the timestamp that is attached in each peripheral packet that is transmitted

Also, when I tried to connect the central to one peripheral device instead of 5 the all packets are transmitted without issues

Any ideas why this can happen?

Thank you for your time

Parents
  • Can you provide the connection parameters used for the various connections and also the scanning parameters while scanning/establish connection?

    Also read this if you haven't:
    https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/multilink_scheduling/multilink_scheduling.html

    In specific check out:
    https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/multilink_scheduling/suggested_intervals_windows_s132.html 

    Kenneth

  • Hi Kenneth,

    all peripheral devices have the same connection parameters.

    #define APP_BLE_OBSERVER_PRIO           3                            

    #define APP_ADV_INTERVAL                       256

    #define APP_ADV_DURATION                      0 //18000                       

    #define MIN_CONN_INTERVAL                     MSEC_TO_UNITS(8, UNIT_1_25_MS)            
    #define MAX_CONN_INTERVAL                    MSEC_TO_UNITS(11, UNIT_1_25_MS)           
    #define SLAVE_LATENCY                            0                                         
    #define CONN_SUP_TIMEOUT                     MSEC_TO_UNITS(4000, UNIT_10_MS)  

             
    #define FIRST_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(5000)                   
    #define NEXT_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(30000)                    
    #define MAX_CONN_PARAMS_UPDATE_COUNT    3 

    -------------sdk_config.h-----------------------------

    #ifndef NRF_SDH_BLE_GAP_DATA_LENGTH
    #define NRF_SDH_BLE_GAP_DATA_LENGTH 251
    #endif

    // <o> NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links.
    #ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
    #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1
    #endif

    // <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links.
    #ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
    #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 0
    #endif

    // <o> NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count.
    // <i> Maximum number of total concurrent connections using the default configuration.

    #ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT
    #define NRF_SDH_BLE_TOTAL_LINK_COUNT 1
    #endif

    // <o> NRF_SDH_BLE_GAP_EVENT_LENGTH - GAP event length.
    // <i> The time set aside for this connection on every connection interval in 1.25 ms units.

    #ifndef NRF_SDH_BLE_GAP_EVENT_LENGTH
    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 18
    #endif

    // <o> NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size.
    #ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE
    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247
    #endif

    Thank you for your help!

Reply
  • Hi Kenneth,

    all peripheral devices have the same connection parameters.

    #define APP_BLE_OBSERVER_PRIO           3                            

    #define APP_ADV_INTERVAL                       256

    #define APP_ADV_DURATION                      0 //18000                       

    #define MIN_CONN_INTERVAL                     MSEC_TO_UNITS(8, UNIT_1_25_MS)            
    #define MAX_CONN_INTERVAL                    MSEC_TO_UNITS(11, UNIT_1_25_MS)           
    #define SLAVE_LATENCY                            0                                         
    #define CONN_SUP_TIMEOUT                     MSEC_TO_UNITS(4000, UNIT_10_MS)  

             
    #define FIRST_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(5000)                   
    #define NEXT_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(30000)                    
    #define MAX_CONN_PARAMS_UPDATE_COUNT    3 

    -------------sdk_config.h-----------------------------

    #ifndef NRF_SDH_BLE_GAP_DATA_LENGTH
    #define NRF_SDH_BLE_GAP_DATA_LENGTH 251
    #endif

    // <o> NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links.
    #ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
    #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1
    #endif

    // <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links.
    #ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
    #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 0
    #endif

    // <o> NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count.
    // <i> Maximum number of total concurrent connections using the default configuration.

    #ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT
    #define NRF_SDH_BLE_TOTAL_LINK_COUNT 1
    #endif

    // <o> NRF_SDH_BLE_GAP_EVENT_LENGTH - GAP event length.
    // <i> The time set aside for this connection on every connection interval in 1.25 ms units.

    #ifndef NRF_SDH_BLE_GAP_EVENT_LENGTH
    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 18
    #endif

    // <o> NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size.
    #ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE
    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247
    #endif

    Thank you for your help!

Children
  • It's not possible to schedule 5 peripheral devices with 8ms connection interval. I suggest to set minimum and maximum interval to 20ms, and gap event length to 3. You may also need to try 30ms

    Kenneth

  • I think I have not understood the theory here. I thought that with tighter Connection Interval there is more time for the central to serve more devices in a connection event. 

    I really lost it with the "suggested intervals and windows" article

    1. Why it is not possible to schedule five peripherals with 8 msec ? How have you calculated the 20msec?

    2. Won't this connection interval (20msec) drop the throughput from each peripheral in comparison to 8msec?

    Is there any guide like "suggested intervals and windows" that explains things a little more simple?

    Thank you!

  • Hello,

    A Bluetooth radio can only serve one peer at a time, typically the radio will need to acquire the radio for severval ms each time it want to communicate with a peer device. So if you try to configure 8ms there simply isn't time to handle them all. That is why you need to use a longer connection interval, and how much longer is difficult to say without detailed in-depth knowledge of the link layer of the OS in question and the number of links it must handle (and possible also other radio activity that it must handle (e.g. Wifi that use the same radio in many cases), I would expect this to be somewhere around 30ms in most cases. You are right that the max throughput will drop if you use 30ms compared to 8ms, but it it can't handle 8ms with multiple peers due to the above, then that is more of a theoritical question.

    Kenneth

  • Just a quick notice. The connection interval I use is not 8 msec. It is 10msec (8 * 1.25msec).

    A Bluetooth radio can only serve one peer at a time, typically the radio will need to acquire the radio for severval ms each time it want to communicate with a peer device. So if you try to configure 8ms there simply isn't time to handle them all.

    Please tell me if I understand correctly the following

    1. A connection interval is the time between two connection events where the two peers can exchange data.

    2. A connection interval of 10 msec corresponds to the communication of one peripheral and the central. You mean that this amount of time is not enough for the central to communicate with one peripheral and it should be >=20 msec.

    3. A connection interval of 10 msec corresponds to one peripheral. So for 5 peripherals the central device must give 50 msec of its time to serve all five devices. Why do you say that the central cannot handle them all in 10msec since it is only for one device and not all of them?

    4. The connection event length extension is the time added at the end of one Connection Interval before the next connection event of the peripheral taking place in the communication

    5. How do I calculate the event length extension time and should I activate it somehow in firmware?

    Thank you

  • You are missing one important point, and that is that it take time to exchange data, let's assume ~3ms. This means that if you configure a 8ms connection interval, then the radio resources in the phone will be allocated already 3/8*100%=37.5% for that specific link. If you add 2more peripherals then you it's (3+3+3)/8*100%=112.5%, which does not compute, so it will start losing packet. Adding more devices (e.g. 5 in total) will make it even worse.

    Kenneth

Related