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

Is BLE_GATTC_WRITE_CMD_TX_QUEUE a queue for all connections or a queue for each connection?

Hi,

I´m using nrf52840 with softdevice S132 and I wonder whether the ble_gattc_conn_cfg_t::write_cmd_tx_queue_size is a queue common for all connections or if it a queue for each connection?

So if I have 10 connections and set ble_gattc_conn_cfg_t::write_cmd_tx_queue_size to 20, does that mean I have a queue of 20 writes for each connection (so queue with 200 writes) or is it a queue of 20 writes that all connections share?

This part is not really explained in the API documentation:

uint8_t ble_gattc_conn_cfg_t::write_cmd_tx_queue_size
The guaranteed minimum number of Write without Response that can be queued for transmission.

The default value is BLE_GATTC_WRITE_CMD_TX_QUEUE_SIZE_DEFAULT

Parents
  • Hello,

    The write_cmd_tx_queue_size is shared between all connections.

    The reason for this is that there is no API for sending the same message to all connected devices. You need to send a message, or queue a write using sd_blegattc_write() to a specific conn_handle, or in other words, to a specific device. If you want to queue up this message for several devices, you need to store them as separate elements in your queue. 

    BR,

    Edvin

  • Ok, I don´t see why not having API for sending same message to all connected devices affects whether having separate queues for each connection or not, but just to verify that I understand correctly.

    So If I would have 2 connections, connection A and B, and write_cmd_tx_queue_size of 20,

    if I queue 20 packets to connection A, and then 1 packet to connection B, the last packet queued on connection B is dropped. Is this how it works?

Reply
  • Ok, I don´t see why not having API for sending same message to all connected devices affects whether having separate queues for each connection or not, but just to verify that I understand correctly.

    So If I would have 2 connections, connection A and B, and write_cmd_tx_queue_size of 20,

    if I queue 20 packets to connection A, and then 1 packet to connection B, the last packet queued on connection B is dropped. Is this how it works?

Children
  • mk2 said:
    if I queue 20 packets to connection A, and then 1 packet to connection B, the last packet queued on connection B is dropped. Is this how it works?

     Yes. Basically. It is not dropped, because queuing the last packet will return NRF_ERROR_RESOURCES. You must then wait for a TX_COMPLETE event, which means that a message from your queue was sent and ACKed, and then you can queue a new message.

    Best regards,

    Edvin

  • Hi again,

    I have set the queue size to 10 as following, but I´m able to queue up to 25 writes when I count the elements in the queue as suggested in the documentation by increasing/decreasing a counter when successfully adding write to the queue and when receiving BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event. How is this possible? Is it not maximum amount of writes that can be queued that write_cmd_tx_queue_size stands for?

        ble_cfg_t ble_cfg;
        memset(&ble_cfg, 0x00, sizeof(ble_cfg));
        ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
        ble_cfg.conn_cfg.params.gattc_conn_cfg.write_cmd_tx_queue_size = 10;
        err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTC, &ble_cfg, ram_start);

Related