Connection interval for nrf52840

Hi ,

 For Battery operated devices, we are using NRF52840, and developing the firmware using Segger Embedded studio +  NRF SDK. s140nrf52720, nRF5SDK1702d674dde

For our application we are using the "Peripheral -  Nordic UART Service NUS" example to send the pressure data over the BLE.

To take it further we are going to add the

  • VT - Variable Transmission Time for sensor data ( adjustable interval from 1 sec to 1 minute)
  • DFU

With above context, while developing the firmware we are facing few issues,

For VT,  after reading the several Noridc forum, we come to know that it’s a Central who decide the connection parameters ( slave latency, connection interval MAX, and MIN, supervision timeout).

 Issue#1 : With below setting, we are able to connect with central after every 10 sec of interval , how can we increase it ? To have interval between connection equal to 60 sec. ?

 

In NUS example when we try to change the connection parameters then code didn’t work

Our plan is to use the connection interval always 1 sec and change the Slave latency to change interval between connection.

However , max connection supervision timeout we can set is 32Sec.

   

Issue#2:

 How can, peripheral firmware be able to accept the change in connection parameter ? is this sufficient to have in the firmware?

   Also, is there any simple way we can change the connection parameter from the Mobile APP and test it?

  

  • Hi Simnor,

    The post you shared is really helpful.

    Okay, noted with BLE we can not go beyond 15sec of connection interval. 

    I kept the parameters same as mentioned in the post for 15 sec connection interval,

    1. MIN_CONN_INTERVAL               MSEC_TO_UNITS(800, UNIT_1_25_MS)
    2. MAX_CONN_INTERVAL               MSEC_TO_UNITS(830, UNIT_1_25_MS)
    3. SLAVE_LATENCY                   18
    4. CONN_SUP_TIMEOUT                MSEC_TO_UNITS(32000, UNIT_10_MS)

    However, with this my effective connection interval is just 10.5 Sec and not close to 15sec. We tried different options but no luck.

    Any idea why it is happening ?

    Second point, I want to change the connection interval from the mobile APP, for this I am sending the new connection interval value from the UART RX characteristic to peripheral. On receiving the value in nus_data_handler(ble_nus_evt_t * p_evt), I am changing the default connection parameters to some fixed value as shown in image.

    New values are taking place and connection interval is changing to 7.5Sec. but after almost 1 min connection interval is again changing to default value in my code i.e. 1 sec.

    Whats wrong , I am doing and because of that values are changing to default after 1 min?

    PS: Fixed values are just for testing, plan is to change the slave latency as per connection interval value sent from the mobile app, keeping the max connection interval to 1sec only. so effective connection interval will be change.

  • Hi Simonr,

    Second issue is solved, by changing the connection parameter update functions 

    ble_conn_params_stop();
    sd_ble_gap_ppcp_set(&params);
    // err_code = sd_ble_gap_conn_param_update(p_evt->conn_handle, &params);
    ble_conn_params_change_conn_params(p_evt->conn_handle, &params);

    However, first issue is still there. Not able to change the connection interval to >10.5Sec.

  • Hi again

    So, the maximum allowed connection intervals set in the BLE specification is 4 seconds. Increasing the connection intervals anything above this should not be done, and is likely to cause errors + being out of the Bluetooth specification.

    Best regards,

    Simon

  • Hi,

    Agree that maximum connection interval is 4 seconds as per BLE specs. However, I am trying to use the slave latency to increase the connection time interval. 

  • Ah, okay. Then AFAIK that should work fine, but then it's most likely a mismatch in the connection parameter update is my guess, and that either the peripheral or central is opting for another slave latency/connection interval.

    It would be helpful to see either the logging information printing what the outcome of the connection parameter update is or the actual on-air sniffer log. You can get a sniffer log with Wireshark, a spare nRF52 series DK, and the nRF Sniffer firmware programmed onto it. I think a sniffer log would be the best next step to take here so we can see what's going on over the air exactly, and why the connection events only go up to ~10 seconds on your end.

    Best regards,

    Simon

Related