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

Sending multiple packets at every interrupt interval

OS in development environment :Windows7
HARD :(Taiyo Yuden)EBSHSN Series Evaluation Board : Central / Peripherals
CPU :(Nordic) nRF52832 / ARMR Cortex-M4F 32 bit processor 28-pin Land Grid Array / 15GPIOs / SWD
Soft Ver:nRF5_SDK_15.3.0_59ac345
Sample program used: "ble_app_uart" / "ble_app_uart_c"

In the sample program, one packet (244 bytes) is transmitted at each connection interval.
How can I send multiple packets at every connection interval?

Setting:
#define MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(30, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define NRF_SDH_BLE_GAP_DATA_LENGTH 251
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247

Thanks for your cooperation.

Parents
  • Hi,

    You should increase NRF_SDH_BLE_GAP_EVENT_LENGTH in sdk_config.h, set it to e.g. 50.

    You might also want to enable extended BLE connection events.

  • 1)Should NRF_SDH_BLE_GAP_EVENT_LENGTH be set to 50 in sdk_config.h for both "ble_app_uart" and "ble_app_uart_c"?
    2)Where can I add a program that enables extended BLE connection events?
    Thanking you in advance.

  • 1) Yes.

    2) Create a function like this:

    and call it after ble_stack_init(), snippet:

  • 1)How can I calculate the value set for NRF_SDH_BLE_GAP_EVENT_LENGTH?
    2)Is the program that enables the extended BLE connection event added to both "ble_app_uart" and "ble_app_uart_c"?
    Thanking you in advance.

  • 1) Set it to match the max connection interval for your application.

    Note that it's also possible to manually increase the TX buffer, e.g.

    (should be added to ble_stack_init() in main.c )

    2) Yes.

    If you want to see the on-air traffic, you should check out the nRF Sniffer.

  • I received an answer to set NRF_SDH_BLE_GAP_EVENT_LENGTH to 50, Is the NRF_SDH_BLE_GAP_EVENT_LENGTH setting value 24 correct when the maximum connection interval is 30 milliseconds?

Reply
  • I received an answer to set NRF_SDH_BLE_GAP_EVENT_LENGTH to 50, Is the NRF_SDH_BLE_GAP_EVENT_LENGTH setting value 24 correct when the maximum connection interval is 30 milliseconds?

Children
  • Yes, then the whole connection interval can be used to send packets if needed. But it’s fine to set it higher also. Connection intervals are ultimately set by the BLE central. For a connection with 1 peripheral link, I usually set NRF_SDH_BLE_GAP_EVENT_LENGTH to 320 (400ms connection interval).

  • Do I need to match the maximum connection interval when multiple peripheral links are connected?
    Example:
    Set NRF_SDH_BLE_GAP_EVENT_LENGTH to 24 when the maximum connection interval is 30 ms.
  • Hi,

    No. That would not be recommended for a link with multiple peripherals. See this link.

  • Is it possible to support multi-packets when connecting two peripherals to Central?

  • Yes, if the SoftDevice scheduler sees that there is enough time to send multiple packets before the next connection event with the other peripheral happens, it will be able to do that. So in practice it will depend on the connection interval used, the NRF_SDH_BLE_GAP_EVENT_LENGTH and the packet size used.