This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BLE Throughput

Hi All,

As far as I know , BLE Thrughput is basically set around a few parameters => 1. NRF_SDH_BLE_GAP_DATA_LENGTH

                                                                                                                            2. NRF_SDH_BLE_GATT_MAX_MTU_SIZE

                                                                                                                            3. NRF_SDH_BLE_GAP_EVENT_LENGTH

My question is => Does the value of NRF_SDH_BLE_GAP_EVENT_LENGTH represent the packets that can be sent in each connection interval?

According to this table : 

If the event length equal 7.5ms,does it mean that it can transmit 6 packets?

Best regards,

Kai

Parents
  • Hi,

    The event length is a Bluetooth concept. A connection event occurs every connection interval, and the duration of it is defined by the event length. During the event length, packets can be exchanged. If the event length is as long as the connection interval, packets can be exchanged more or less continuously. This maximises throughput.

    If the event length equal 7.5ms,does it mean that it can transmit 6 packets?

    Yes and no. If you cant fit 6 packets, then yes. If you can fit more, then you can send more. There is no defined maximum. Note that the documentation you refer to is for an old SoftDevice. More recent SoftDevice versions does not have this bandwidth configuration, but instead just allows you to configure the event length, using NRF_SDH_BLE_GAP_EVENT_LENGTH  as you have found.

  • Hi Einar,

    Here is my sdk_config.h setting

    Now NRF_SDH_BLE_GAP_EVENT_LENGTH  is 6,so my packet will transfer total 6ms?

  • Hi Einar,

    I roughly understand what you mean, but I don't have a clue how to draw a conclusion at the moment, so I won't close this discussion at this time

  • Hi Einar,

    static ret_code_t error_messages_send(ble_gatts_hvx_params_t * const p_hvx_params,  uint16_t conn_handle)
    {
        ret_code_t err_code = sd_ble_gatts_hvx(conn_handle, p_hvx_params);
        if (err_code == NRF_SUCCESS)
        {
            //NRF_LOG_INFO("Error notification has been sent using conn_handle: 0x%04X", conn_handle);
             NRF_LOG_INFO("OK   : %x",AppData_CNT++);
        }
        else
        {
            //NRF_LOG_DEBUG("Error: 0x%08X while sending notification with conn_handle: 0x%04X",
            //              err_code,
            //              conn_handle);
            NRF_LOG_INFO("Fail : %x",AppData_CNT++);
        }
        return err_code;
        
    }
    I checked some stuff about sd_ble_gatts_hvx().

    If it does not return successfully, it means the buffer is full.

    I have also increased the length of NRF_SDH_BLE_GAP_EVENT_LENGTH but it still drops packets.

  • kai19960504 said:
    If it does not return successfully, it means the buffer is full.

    Yes, if sd_ble_gatts_hvx() returns NRF_ERROR_RESOURCES it means the buffer is full. It can also return other error codes though, so you should not assume that all errors indicate that the queue is full.

    kai19960504 said:
    I have also increased the length of NRF_SDH_BLE_GAP_EVENT_LENGTH but it still drops packets.

    OK. There are things you can do (like ensure the event length is equal the connection interval, and that it is of sensible length). But there will be a limit to the throughput. And if you try to send more then the link can handle, you will get NRF_ERROR_RESOURCES returned from sd_ble_gatts_hvx(). That is expected.

  • Hi Einar,

    like ensure the event length is equal the connection interval

    I currently make the event length equal to the connection interval according to your method. After testing several times, the problem of packet loss does not occur.

    So the setting value of Event length is best equal to connection interval?

  • kai19960504 said:
    So the setting value of Event length is best equal to connection interval?

    If the goal is maximal throughput with a single connection, then yes. 

Reply Children
No Data
Related