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

Is an hvn tx queue allocated per characteristic?

I'm wondering about how the notification queues are allocated when setting hvn_tx_queue_size using ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size.

If I set it to some length, say 30, does that mean that a queue of size ( 30 * max_characteristic_length) bytes is assigned for each characteristic that has notifications enabled? Or is the queue shared for the whole service so that if I had 2 characteristics that have notifications enabled, the buffer is populated with the data types of each characteristic.

What happens when I have multiple connections? Is it possible to set the queue size for each characteristic so I can have a large queue for a high data rate characteristic and a small queue for a low data rate characteristic? How can I calculate the change in RAM requirements of the softdevice if I change hvn_tx_queue_size?

Parents
  • No, it's a single queue that the softdevice uses to send notifications to everything, i.e. to all characteristics from all services of every peripheral link.

    Having a bigger queue just means that you'll be able to queue more notifications before you get NRF_ERROR_RESOURCES. And this can happen no matter what the queue size is. For example, if you call sd_ble_gatts_hvx in a for loop you will only be able to queue X notifications before you get errors.

    You have to handle these errors somehow. A popular approach is clearing a flag on HVX_TX_COMPLETE.

Reply
  • No, it's a single queue that the softdevice uses to send notifications to everything, i.e. to all characteristics from all services of every peripheral link.

    Having a bigger queue just means that you'll be able to queue more notifications before you get NRF_ERROR_RESOURCES. And this can happen no matter what the queue size is. For example, if you call sd_ble_gatts_hvx in a for loop you will only be able to queue X notifications before you get errors.

    You have to handle these errors somehow. A popular approach is clearing a flag on HVX_TX_COMPLETE.

Children
No Data
Related