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

Update characteristic every 1 second with notification while CI set to 3 seconds

Hi,

i update my characteristic every 1 second with a new value. the notification is set for the characteristic and it will notify my phone about the new value. at the same time i set the connection interval to between 3 seconds to 3.5 seconds.

i test this configuration and i notice when i establish the connection the value of the characteristic is updated every 1 second. i think because at the beginning of the connection the phone work with his own connection interval.

after like 5 seconds the value start updated every 3 seconds. normally the phone (central device) accepted the min and max Connection interval imposed by the peripheral.

i want to know when the connection interval occurs the peripheral will send the 3 updated values of the characteristics or it will send the last one ?

the most important question : this connection interval is OK for me because of energy efficiency purpose. but in some operation like reading datas from flash memory and update them to the characteristic i need a short connection interval otherwise it will take me hours to read all the value stored in the memory. can the peripheral reduce the connection interval when reading the flash memory operation then set it back to 3 seconds after finishing the read operation?

thanks

Parents
  • I'm not sure what you mean by that you are updating your characteristic value. I'm guessing that you are just sending notifications by calling sd_ble_gatts_hvx(), and that you are not calling sd_ble_gatts_value_set().

    Every time sd_ble_gatts_hvx() is called and returns NRF_SUCCESS the notification will be put into a buffer and sent in the next available connection interval. If there is no buffer available it will return BLE_ERROR_NO_TX_PACKETS, which means that the notification will not be sent, and you must retry at a later point in time. So if you have buffered 3 notifications these will all be sent, not only the last one.

    The central device dictates the CI, the only thing the peripheral can do is to send a CPU request, then it's up the central to accept or reject this request. Also, at least on Android you can request connection priority with this API.

Reply
  • I'm not sure what you mean by that you are updating your characteristic value. I'm guessing that you are just sending notifications by calling sd_ble_gatts_hvx(), and that you are not calling sd_ble_gatts_value_set().

    Every time sd_ble_gatts_hvx() is called and returns NRF_SUCCESS the notification will be put into a buffer and sent in the next available connection interval. If there is no buffer available it will return BLE_ERROR_NO_TX_PACKETS, which means that the notification will not be sent, and you must retry at a later point in time. So if you have buffered 3 notifications these will all be sent, not only the last one.

    The central device dictates the CI, the only thing the peripheral can do is to send a CPU request, then it's up the central to accept or reject this request. Also, at least on Android you can request connection priority with this API.

Children
No Data
Related