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

when the SoftDevice Event rise SD_EVT_IRQ in Central Role? What's connect timing mode for multi-link in Central Role?

Hi:

    We are develop an Central Device can Connect 8 BLE Device in same time. and want max throughout. it use queue and freeRTOS.  the Central TX is simple.

    use  sd_ble_gattc_write() with BLE_GATT_OP_WRITE_CMD to write.  wait semaphore event rise by BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event. 

   but between the SD_EVT_IRQ interrupt rise(BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE ) and sd_ble_gattc_write, it  take about 7.5ms. not our expect 2.5ms(1Mbps) or 1.4ms(2Mbps).  When SD_EVT_IRQ interrupt rise by SoftDevice?  why it same value as NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL ? 

Is NRF_SDH_BLE_GAP_EVENT_LENGTH  use to reduce SD_EVT_IRQ  frequency?  Do the Nordic Semiconductor have guidebook for these config parameters? or have excel document can calculate these parameters?

   how the SoftDevice handle Multi-linked peripheral connect timing? 

   from "Connection timing as a Central" charter of S140_SDS_v2.1,  Do SoftDevice use one Big time Slot to scan each connected peripheral? each peripheral get equalization chance?

|  peripheral 1 connect timing(7.5ms) | peripheral 2 connect timing(7.5ms)  | .... | peripheral 8connect timing(7.5ms)|   --> Next loop

|_____________________________|_____________________________|_______________________________|

   or just each peripheral has random shift start connect timing? 

           |  peripheral 1 connect timing(7.5ms) |

                |  peripheral 2 connect timing(7.5ms) |

                 .....

                     | peripheral 8connect timing(7.5ms)| 

 

Here the Central Config:

#define NRF_SDH_BLE_GAP_DATA_LENGTH 251

#define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 0

#define NRF_SDH_BLE_CENTRAL_LINK_COUNT  8

#define NRF_SDH_BLE_TOTAL_LINK_COUNT    8

#define NRF_SDH_BLE_GAP_EVENT_LENGTH 6

#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247

#define NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL 7.5

the "Connection Event Length Extension" is enabled.  and connect peripheral use min_conn_interval=max_conn_interval=7.5ms.  peripheral use  BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE/BLE_GATT_CHAR_PROPERTIES_NOTIFY.

  • Hello,

    Thank you for your patience with this. The summer holidays have begun here in Norway, and DevZone is therefore operating with reduced staff for the time being. Sorry for any inconvenience this might cause.

    Do SoftDevice use one Big time Slot to scan each connected peripheral?

    SoftDevice scans with scan interval and window parameter to listen packets from advertisers which is not related with already connected peripherals. I suppose you might have meant each connection event when you said 'scanning each connected peripheral' - since there is no scanning of connected devices. If so, since you are already connected to 8 peripherals, the SoftDevice will already have placed timeslots for each connection event with each peer.
    each peripheral get equalization chance?

    Yes.

    how the SoftDevice handle Multi-linked peripheral connect timing? 

    For reference, In SDS v2.1 p.71, there is already an illustration of multilink scheduling with 8 connections (Figure 34). Each peripheral has its own connection interval (stated 7.5ms for each) between their connection events. Each peer's connection events are relative to the each other so their slot are placed when the connection is established and their relativity will remain same.

    just each peripheral has random shift start connect timing? 

    It is not random, they are placed relatively to each other assuming the connection intervals have a common factor see Figure 27 on page 60.

    Is NRF_SDH_BLE_GAP_EVENT_LENGTH  use to reduce SD_EVT_IRQ  frequency?  Do the Nordic Semiconductor have guidebook for these config parameters? or have excel document can calculate these parameters?

    Depending on the SD version, you can see the description and default values for these parameters;
    event length will have implicit effect on evt_IRQ frequency.

    Let's say 1MBPS used, minimum connection interval is 2.5ms and for 8 connections
    8*2.5ms=20ms for only connection events which does not fit into 7.5ms connection interval that they set.
    page 70 Figure 30 shows if there is no timeslot available in first relative connection interval. Please also know that higher priority is given to linked devices which are about to reach their timeout.

    I suggest to first increase your connection interval to a multiple of 20ms and observe bandwidth.
    If you are setting BLE_GAP_EVENT_LENGTH (multiples of 1.25ms) to 6, the suggested connection interval makes 60ms for 8 connections with each having 7.5ms event. If you want to increase their connection interval more, they can enable "Connection Event Length Extension" since this feature can increase the bandwidth by utilizing "idle" time between connection events.

    You can read more about the multilink scheduling of the SoftDevice here, particularly at the Connection timing as Central page.

    Please do not hesitate to ask if any part of this should still be unclear, or if you encounter any other issues or questions!

    Best regards,
    Karl

  • Thanks for your help.  Still have some question about SoftDevice inside.

    Question:

     1) central config support 8 peripheral link connection, if only one connection established, do the SoftDevice still handler other 7 connection  time slot? if yes, why ? is the "connectionInterval 0" value of by sd_ble_gap_connect() setting value? Not NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL? 

    2)  do the SoftDevice have own GATTC for each connection peripheral   in Central mode? Do SoftDevice have own inside buffer(sd_ble_gattc_write() API write to,  BLE_GATTC_EVT_HVX event receive buffer) for each connection? Do they are queue Buffers? or just single(from my debug info, seem this is true, because second call sd_ble_gattc_write() will return NRF_ERROR_RESOURCES) ?

    3)  when the SoftDevice trigger the SD_EVT_IRQHandler? for example, when the SoftDevice radio finish the sd_ble_gattc_write() data package? Or finished the one device connection timing?  my issue: the SD_EVT_IRQHandler frequency is too slow. it about 135Hz. about 7.5ms interval. not our expect 400Hz(1Mbps) or 714Hz(2Mbps). 

  • About Question 3:  what 's the SD_EVT_IRQHandler interrupt rise timing? can like this? 

    <-  Peripheral Device 1 connect timing (7.5ms)  ->

    |-----------------------------------------------------------------|

    | T  |  R |  T  | R  | ....                                              |

    | X  |  X |  X  | X  | ....                                              |

    |----------------------------------------------------------------|

         ↓    ↓      ↓     ↓

    Interrupt Rise(if radio data sent or OK data received)

  • Hello again,

    Thank you for your continued patience with this.

    wen jin zhang said:
    Thanks for your help.

    No problem at all, I am happy to help!

    wen jin zhang said:
    1) central config support 8 peripheral link connection, if only one connection established, do the SoftDevice still handler other 7 connection  time slot? if yes, why ? is the "connectionInterval 0" value of by sd_ble_gap_connect() setting value? Not NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL? 

    No, the central does not have 8 separate slots. It will scan according to the scan configuration, and then place timeslots for the peripheral as they are connected. 

    wen jin zhang said:
    2)  do the SoftDevice have own GATTC for each connection peripheral   in Central mode? Do SoftDevice have own inside buffer(sd_ble_gattc_write() API write to,  BLE_GATTC_EVT_HVX event receive buffer) for each connection? Do they are queue Buffers? or just single(from my debug info, seem this is true, because second call sd_ble_gattc_write() will return NRF_ERROR_RESOURCES) ?

    The SoftDevice allocated a GATTC buffer pool per connection. What is your current queue size set to? The default value is 1, so this might be why you are getting NRF_ERROR_RESOURCES on your second function call.

    wen jin zhang said:
    3)  when the SoftDevice trigger the SD_EVT_IRQHandler? for example, when the SoftDevice radio finish the sd_ble_gattc_write() data package? Or finished the one device connection timing?  my issue: the SD_EVT_IRQHandler frequency is too slow. it about 135Hz. about 7.5ms interval. not our expect 400Hz(1Mbps) or 714Hz(2Mbps). 

    The event will be generated when the operation has finished, but the application's SD_EVT_IRQhandler will not be called until after the SoftDevice is finished processing and releases the control of the CPU back to the application layer. No application layer instructions are happening when the CPU is used by the SoftDevice, and all events that are generated in the time that the SoftDevice is active will be pending when the application resumes.

    Best regards,
    Karl

  • Thanks for your support!

    Karl YIvisaker answer:

    The SoftDevice allocated a GATTC buffer pool per connection. What is your current queue size set to? The default value is 1, so this might be why you are getting NRF_ERROR_RESOURCES on your second function call.

    Yes, we used the default value 1.  We only found can change hvn_tx_queue_size  of GATT Server  and write_cmd_tx_queue_size for GATT client. all the for transmitter.  Why No for Receiver? Do SoftDevice have ping-pong buffer for GATT Server and GATT client receiver? 

    we change hvn_tx_queue_size  = 3, write_cmd_tx_queue_size  =3, but still only get 32KB/s == 256kbps.  for one connection. (scan disable when connected).  the examples\ble_central_and_peripheral\experimental\ble_app_att_mtu_throughput  about 992.07kbps (PHY: 2 Mbps, ATT MTU = 247 bytes, DLE: enabled, Connection interval: 7.5 millisecs).   

    our example also use Device GATTS sd_ble_gatts_hvx send.  Central receive the data. the SD_EVT_IRQHandler frequency still about 135Hz.  the Device GATTS feed data as far as possible. same ATT MTU =247, Data Length=251.  

Related