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.

  • Karl pls assist at earliest:

    In code pls help how to do:

    1). 100ms Connection interval what shall be possible values of Slave latency and  Connection supervision timeout

    2). 200ms Connection interval what shall be possible values of Slave latency and  Connection supervision timeout

    3). 1000ms Connection interval what shall be possible values of Slave latency and  Connection supervision timeout

    4). 4000ms Connection interval what shall be possible values of Slave latency and  Connection supervision timeout

     how to know about how connection supervision timeout and slave latency are working like in blinky example say

  • Ridhi said:
    i have set max min Connection interval as 2000 and supervision tiemout as 8000ms. This in blinky code worked. But when i am setting max min CI as 4000ms it is not working.

    Strange that you did not have to use 8001.25 ms connection timeout, but I suppose it should be an equal to or greater sign instead of just a greater sign.

    The BLE specification equation has to hold for the parameters to be valid, so instead of calculating all of them I will demonstrate on your 4) question, and then you can apply the same logic to the 1-3) cases.
    For a 4000 ms connection interval, with a slave latency for 1 (for the sake of the example), you will need your connection supervision timeout to be 16000 ms at least.
    I tested this on my end with 16010 ms, and I am not seeing any errors - it is working as expected.
    You could try with these parameters yourself in the BLE blinky application and see if you observe the same.

    #define MIN_CONN_INTERVAL               MSEC_TO_UNITS(4000, UNIT_1_25_MS)        /**< Minimum acceptable connection interval (0.5 seconds). */
    #define MAX_CONN_INTERVAL               MSEC_TO_UNITS(4000, UNIT_1_25_MS)        /**< Maximum acceptable connection interval (1 second). */
    #define SLAVE_LATENCY                   1                                       /**< Slave latency. */
    #define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(16010, UNIT_10_MS)         /**< Connection supervisory time-out (4 seconds). */
    

    Ridhi said:
    Also, i am not getting what is this connection supervision timeout. 

    Please see my earlier comment explaining the connection supervision timeout. Please do not hesitate to ask if any part of it should be unclear.

    Best regards,
    Karl

  • Ok Karl i got to understand about the above discussion about connection interval.

    I tried to understand your comment and discussion about supervision timeout but i am not able to understand. Eg: say i have nordic blinky code and i set the supervision timeout as 4 secs. i am not getting what and how this we can see its effect on nrf connect app. 

    i have slave latency of 0 say, in nordic blinky code there are two services:  button and led. how will pheripheral know that it has no data to send so it sets the slave latency.

    i am very much confused inunderstanding

  • Ridhi said:
    i have slave latency of 0 say, in nordic blinky code there are two services:  button and led. how will pheripheral know that it has no data to send so it sets the slave latency.

    I am sorry to hear that, RIDHIMA. Please do not hesitate to ask if any part of my answer should be unclear, so that I may elaborate.

    Ridhi said:
    say i have nordic blinky code and i set the supervision timeout as 4 secs. i am not getting what and how this we can see its effect on nrf connect app. 

    The simplest explanation of the connection supervision timeout is: "It is how long will the device attempt to contact a peer that has stopped responding"
    So, if you have 4 s supervision timeout on your peripheral, and you are in connection with a nRF Connect central. If the central stops responding to the peripheral (they both expect to exchange a packet at least for once every connection interval) such as if it leaves the area, or goes into an elevator or similar, they will both still try to communicate with each other for each passing connection interval - in hopes that they will hear from each other again, and continue the connection. The connection supervision timeout tells them how long they should keep trying to reach the peer that is no longer responding.
    When a connection is terminated the devices will usually go back into either scanning or advertising so that they can find a new connection. This will not happen until the connection supervision timeout has expired., because both devices still consider the connection as working so long as it has not expired (even though they do not hear anything from their peer).

    Ridhi said:
    how will pheripheral know that it has no data to send so it sets the slave latency.

    The peripheral can know this by checking the contents of the packet it intends to send in the upcoming connection event.
    If the packet is empty and the slave latency is > 0 it can skip the upcomming connection event. If the packet is non-empty (contains data) it should transmit during the event.

    Best regards,
    Karl

  • Hello Karl

    I have a ble nrf52832 dev kit. I have interfaced flash and temp sensor STTS with it. I am using it for temp data logging. I have intially set the connection parameters as:

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

    #define SLAVE_LATENCY 0 
    #define CONN_SUP_TIMEOUT MSEC_TO_UNITS(9000, UNIT_10_MS) /
    #define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000) 
    #define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(3000) /
    #define MAX_CONN_PARAMS_UPDATE_COUNT 3 

    I press a button  my device advertsises

    then i connect using nrf connect app

    .Created a custom service ,

    press button  deevice goes to logging mode and gives abot 20 logs for 10 mins say.

    then i again press button to put device in sleep mode

    then again press button to re advertise and connect on app

    then enable notification of the created service and then read the temp logs.

    with above connection parameters i am able to get the logs but when i set the values for power optimization as:

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

    #define SLAVE_LATENCY 0 
    #define CONN_SUP_TIMEOUT MSEC_TO_UNITS(9000, UNIT_10_MS) /
    #define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000) 
    #define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(3000) /
    #define MAX_CONN_PARAMS_UPDATE_COUNT 3 

    i am only able to get 4 logs just for 1 min and then my system is going to sleep state instead of giving logs

Related