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

Reponse time of WRITE WITH RESPONSE command

Hi

I'm using a NRF52840 as multi central with 8 connections

SDK: 15.0; SD: 6.1 S140

My central connects to a peripheral with a connection interval of 50ms and latency of 0

When connected to 1 peripheral, from the time of issuing the sd_ble_gattc_write() command to the time I receive the BLE_GATTC_EVT_WRITE_RSP event is on average +-100ms.

As soon as I receive the response, I immediately send the next command and keep doing this.

With 2 peripherals connected, the turnaround time from command to the event is +-200ms. I tested it up to 6 connections the led to a 600ms turnaround time form sending the message to receiving the BLE_GATTC_EVT_WRITE_RSP. 

Is there an internal delay/queue/timer in the softdevice for sending messages? What else could be causing this?

Thanks

Parents
  • Hi Tielman, 

    Are you able to capture a sniffer trace of the on-air packets using a BLE protocol sniffer e.g. Ellisys or using the nRF Sniffer v2 ? It would be very useful in debugging the issue. 

    Also have you altered the NRF_SDH_BLE_GAP_EVENT_LENGTH, NRF_SDH_BLE_GATT_MAX_MTU_SIZE or NRF_SDH_BLE_GAP_DATA_LENGTH values in sdk_config.h?

    The S140 in a central role will schedule the connections as described in the Connection timing as a Central section in the S140 SoftDevice Specification. In addition to the scheduling the connection events, the central will also add the scanner event after all the connection events, see Figure 3. Scanner timing - one or more connections as a Central in the Primary channel scanner timing section.  

    In short, if all the write request are send at the same time then the last connection that is scheduled be sent after N*Connection Event Length, where N is the number of connections. So with 50ms and a connection event length off 6*1.25ms = 7.5ms, then the last Write request will be sent 8*7.5ms = >60 milliseconds after the first connection event. If you're scanning at the same time, then the scan window will have to be added to the N*Connection Event Length value. 

    Best regard 

    Bjørn

  • Hi Bjørn

    I have not changed those parameters in the config file, but here is what they are configured as:

    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 320

    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247

    #define NRF_SDH_BLE_GAP_DATA_LENGTH 27

    My scan window is 50ms and interval is 100ms, though when I have 8 connections, scanning is stopped so this will only apply to the connection graphs above with less than 8 connections.

    Thanks for the links. I see there is some optimization I need to do in terms of my connection intervals and scanning windows and intervals. Regardless, and to understand the timing better:

    1) You gave an example Connection Event Length of 7.5ms

    connection event length off 6*1.25ms = 7.5ms

    , however, from my graphs, it looks like my Tevent-Cx = 30ms since the events arrive 30ms apart? Why so slow and is there a way to reduce this?

    2) I honestly don't understand what NRF_SDH_BLE_GAP_EVENT_LENGTH  is for. Infocentre gives the following description

    "The time set aside for this connection on every connection interval in 1.25 ms units"

    Does this have a part to play in the connection event length?

    I will try and get my packet sniffer working and let you know what I find.

Reply
  • Hi Bjørn

    I have not changed those parameters in the config file, but here is what they are configured as:

    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 320

    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247

    #define NRF_SDH_BLE_GAP_DATA_LENGTH 27

    My scan window is 50ms and interval is 100ms, though when I have 8 connections, scanning is stopped so this will only apply to the connection graphs above with less than 8 connections.

    Thanks for the links. I see there is some optimization I need to do in terms of my connection intervals and scanning windows and intervals. Regardless, and to understand the timing better:

    1) You gave an example Connection Event Length of 7.5ms

    connection event length off 6*1.25ms = 7.5ms

    , however, from my graphs, it looks like my Tevent-Cx = 30ms since the events arrive 30ms apart? Why so slow and is there a way to reduce this?

    2) I honestly don't understand what NRF_SDH_BLE_GAP_EVENT_LENGTH  is for. Infocentre gives the following description

    "The time set aside for this connection on every connection interval in 1.25 ms units"

    Does this have a part to play in the connection event length?

    I will try and get my packet sniffer working and let you know what I find.

Children
No Data
Related