Connection parameters in nrf ble

want to know how can i judge that the variation is caused in the connection interval, connection supervision timeout, slave latency once i have flashed ble_app_template code in nrf52832 s132.

Parents Reply Children
  • The central decides the connection interval (and all the other connection parameters), but the peripheral might request certain changes, or reject the connection parameters the central decides (rejecting the parameters means that the peripheral will terminate the connection).

    You can set the connection interval by changing the NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL and NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL in sdk_config.
    You may set them to the same value, to force a specific connection interval.

    Best regards,
    Karl

  • this NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL  you have told for central code??

    if want want to set the Connection Interval as 100ms in peripheral,  how will i set it? i know that this

     #define MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS) and 

    #define MAX_CONN_INTERVAL               MSEC_TO_UNITS(75, UNIT_1_25_MS)       commands are used but how to set value of Connection Interval as 100ms using these?? 

  • Ridhi said:
    this NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL  you have told for central code??

    Yes, these defines are used on the central side.
    The equivalent defines for the peripheral side are the ones you mention, MIN_CONN_INTERVAL and MAX_CONN_INTERVAL.
    If you want to set exactly 100 ms as the interval you must set both of these to 100 ms, like so:

    #define MIN_CONN_INTERVAL               MSEC_TO_UNITS(100, UNIT_1_25_MS)
    
    #define MAX_CONN_INTERVAL               MSEC_TO_UNITS(100, UNIT_1_25_MS)


    But keep in mind that the central has the final word, and may not always listen to the requests of the peripheral.

    Best regards,
    Karl

  • KARL, pls administer my queries

    1). if i want to set Connection interval as 1000ms say then, is this i will have to do:

    #define MIN_CONN_INTERVAL MSEC_TO_UNITS(1000, UNIT_1_25_MS)

    #define MAX_CONN_INTERVAL MSEC_TO_UNITS(1000, UNIT_1_25_MS) ?

    2). I have nrf connect app for android, ran nordic blinky code of nrf sdk v17.2 on nrf52832 dk. i checked this on power profiler kit 11. that as i clik on connect option in nrf app power profiler gives abou 50 ms delay between connection events and then later after 20ms then first connection parameters get changed and then it shows about 200ms CI. is this right i am understanding that master has intially set the CI as 50ms and then based on peripheral this interval was updated

  • Ridhi said:
    if i want to set Connection interval as 1000ms say then, is this i will have to do:

    Yes, this will set the peripheral's preferred connection interval to 1000 ms.
    But, since the peripheral does not decide the connection parameters it can only make a connection parameter update request with its preferred connection interval, and hope that the central will accept it.

    Ridhi said:
    I have nrf connect app for android, ran nordic blinky code of nrf sdk v17.2 on nrf52832 dk. i checked this on power profiler kit 11. that as i clik on connect option in nrf app power profiler gives abou 50 ms delay between connection events and then later after 20ms then first connection parameters get changed and then it shows about 200ms CI. is this right i am understanding that master has intially set the CI as 50ms and then based on peripheral this interval was updated

    You are right that the central has set whatever connection interval is being used.
    I can not say anything for certain about exactly which connection parameters are being used, since I have not seen a sniffer trace or logs of this, but it sounds like it could be the case that the central updated the connection interval after a request from the peripheral.
    Most of our BLE Peripheral examples will do a connection parameter update request after a timeout expires (usually 5 seconds), when it will ask to have the connection parameters updated to match its preferences. If you have not implemented this connection parameter update request in your own application yet I recommend that you take a look to see how it is done in the examples.

    If you are connecting to your peripherals using the nRF Connect application, could you share the log from a connected session? The logs will let us know what connection parameters are being used, and if it was updated by the central based on a request from the peripheral.

    Best regards,
    Karl

Related