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

Keep fast connection interval

Hi,I want to ble stay in fast connection interval after connection succeed. So I set the connection parameters like that:

#define DEFAULT_DESIRED_MIN_CONN_INTERVAL      MSEC_TO_UNITS(20, UNIT_1_25_MS)
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL     MSEC_TO_UNITS(40, UNIT_1_25_MS)
#define DEFAULT_DESIRED_SLAVE_LATENCY             0 
#define DEFAULT_DESIRED_CONN_TIMEOUT             MSEC_TO_UNITS(600, UNIT_10_MS)

But it seems it doesn't work fine.I use the android phone to test the speed,and I find out it takes 500ms when app received a packet.Did I miss something.

Parents
  • Hi,

    It is not quite clear what you mean by "I used the android phone to test the speed, and I find out it takes 500 ms when app received a packet." If it includes connection setup it is clear that it would take much longer than a single connection interval. Also, if there is a lot of data to be transferred it would take several BLE packets and several connection events. You must also account for the handling of BLE packets by the BLE stack on the Android, and delays on the Android system and in the Android APIs before the contents is displayed in the Android app. In addition you may have packet losses which leads to retransmits.

    I will update this answer if you can explain the following clearly:

    • What methods are you using for data transfer? (notifications? advertising packets? other? Describe as much as possible regarding your setup.)
    • How do you measure the 500 ms delay?
    • What exactly are you measuring, i.e. what defines the starting point and stopping point for measuring the delay?

    Note that even though the pheripheral has preferred connection parameters it is up to the central to decide. This means there is no guarantee you will actually get the connection parameters you ask for. However, most likely the connection parameters are in or close to the range you have specified, so it would not account for delays of 500 ms. To check the actual connection parameters you can do one of the following:

    • You can use the nRF sniffer and Wireshark to see the connection interval. (Any other BLE sniffer would also do, of course.)
    • If you have UART or RTT output you can print the parameters. If you use our SDK you will get the connection parameters on the BLE_GAP_EVT_CONNECTED event (p_ble_evt->evt.gap_evt.params.connected.conn_params) and on the BLE_GAP_EVT_CONN_PARAMS_UPDATE event (p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params).

    Regards, Terje

Reply
  • Hi,

    It is not quite clear what you mean by "I used the android phone to test the speed, and I find out it takes 500 ms when app received a packet." If it includes connection setup it is clear that it would take much longer than a single connection interval. Also, if there is a lot of data to be transferred it would take several BLE packets and several connection events. You must also account for the handling of BLE packets by the BLE stack on the Android, and delays on the Android system and in the Android APIs before the contents is displayed in the Android app. In addition you may have packet losses which leads to retransmits.

    I will update this answer if you can explain the following clearly:

    • What methods are you using for data transfer? (notifications? advertising packets? other? Describe as much as possible regarding your setup.)
    • How do you measure the 500 ms delay?
    • What exactly are you measuring, i.e. what defines the starting point and stopping point for measuring the delay?

    Note that even though the pheripheral has preferred connection parameters it is up to the central to decide. This means there is no guarantee you will actually get the connection parameters you ask for. However, most likely the connection parameters are in or close to the range you have specified, so it would not account for delays of 500 ms. To check the actual connection parameters you can do one of the following:

    • You can use the nRF sniffer and Wireshark to see the connection interval. (Any other BLE sniffer would also do, of course.)
    • If you have UART or RTT output you can print the parameters. If you use our SDK you will get the connection parameters on the BLE_GAP_EVT_CONNECTED event (p_ble_evt->evt.gap_evt.params.connected.conn_params) and on the BLE_GAP_EVT_CONN_PARAMS_UPDATE event (p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params).

    Regards, Terje

Children
No Data
Related