How to increase the number of packets sent in a single TX transmission?

I sent a 242-byte data packet, and using the NRF sniffer to capture the packets, I found that this packet was split into (27-byte per packet) for transmission. This caused the entire sending process to take 4ms, while our transmission timing is 3ms, ultimately leading to a stack overflow on the transmitting end. How can we increase the single transmission size, and which configuration allows us to send a 242-byte data packet in one go?

Parents
  • Hello,

    In BLE, MTU has a default value of 23 bytes, and data length has a default value of 27 bytes. When MTU is larger than data length, the data will be segmented into chunks of the data length’s size. This means that, for your application, it appears like one message is being sent, but on the air, the data is actually split into smaller segments. To send  a 242-byte data packet in a single Bluetooth LE transmission (i.e., without fragmentation into 27-byte packets), you need to increase both the Data Length and the ATT MTU in your BLE configuration.  Try adding the following in your prj.conf file:

    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_L2CAP_TX_MTU=247

    Best Regards,

    Swathy

Reply
  • Hello,

    In BLE, MTU has a default value of 23 bytes, and data length has a default value of 27 bytes. When MTU is larger than data length, the data will be segmented into chunks of the data length’s size. This means that, for your application, it appears like one message is being sent, but on the air, the data is actually split into smaller segments. To send  a 242-byte data packet in a single Bluetooth LE transmission (i.e., without fragmentation into 27-byte packets), you need to increase both the Data Length and the ATT MTU in your BLE configuration.  Try adding the following in your prj.conf file:

    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_L2CAP_TX_MTU=247

    Best Regards,

    Swathy

Children
  • Thanks beauty

    We have set the connection interval to 7.5ms and the transmission timing to 3ms. We found that Bluetooth can send data packets normally within the 7.5ms interval. However, after sending the second data packet, Bluetooth will force the next transmission to wait until the end of the 7.5ms connection interval, which causes blockage on the transmitting end.
    Currently, we have configured the connection event extension with CONFIG_BT_USER_DATA_LEN_UPDATE=y, CONFIG_BT_CTLR_DATA_LENGTH_MAX=251, and the GAP event interval with CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=7500.
    Are we missing any key configurations such as the "Connection event length extension" in nRF52840, like setting opt.common_opt.conn_evt_evt.enable=true; err_code=sd_ble_opt_set(BLE_COMMON_OPT_CONN_EVT_EVT,&opt);? Or are there any existing configurations that need to be enabled in the main function?
Related