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

How to increase credit in L2CAP

Hello,

MCU: nRF52832;

SDK: 15.3;

Project: examples\ble_peripheral\experimental\ble_app_ots

nrf52832 receive data from app, communication by L2CAP, I want to increase throughput to 40kBps.

Now the iphone 8/xr can reach, but iphone 11/12 only 28kBps

//-------------------------------

1: Can I increase throughput by increase L2CAP Credit? How can I increase credit?  I try this define "#define BLE_L2CAP_CREDITS_DEFAULT (1)", but it seems no useful.

2: Iphone 8 can reach 40kBps, Why iphone 11/12 can't reach? I found there many abnormal communication. The btt file is the log of communication.

#define MAX_ALLOCATED_OBJECT_SIZE 2048
#define L2CAP_RX_MPS      2048
#define L2CAP_TX_MPS      40
#define L2CAP_RX_MTU      2048 

 iphone11.bttiphone8.btt

Parents
  • Unfortunately the nRF5 SDK OTS example is not optimized for throughput.

    To increase throughput I suspect one of these two must be changed, either increase queue size:
    ble_cfg.conn_cfg.params.l2cap_conn_cfg.rx_queue_size = 1; // Need to be more than 1

    or increase credits to 2, 3, or 4:
    sd_ble_l2cap_ch_flow_control(uint16_t conn_handle, uint16_t local_cid, uint16_t credits, uint16_t *p_credits)) // with credits set to 2, 3, or 4 might be possible
    Looking at the logs I can see that iphone 8 and 11 behave a bit differently:
    It looks like the second to last packet don't have the MD bit set on iphone 11, in other words it is as if the last 2bytes is not ready in the link layer of the host on iphone 11 yet, while it is ready on iphone 8. This cause the transfer to be slower on iphone 11, since it wait until next connection interval to send the last 2bytes, but I do not know why there is a difference.
    Hope it helps,
    Kenneth
Reply
  • Unfortunately the nRF5 SDK OTS example is not optimized for throughput.

    To increase throughput I suspect one of these two must be changed, either increase queue size:
    ble_cfg.conn_cfg.params.l2cap_conn_cfg.rx_queue_size = 1; // Need to be more than 1

    or increase credits to 2, 3, or 4:
    sd_ble_l2cap_ch_flow_control(uint16_t conn_handle, uint16_t local_cid, uint16_t credits, uint16_t *p_credits)) // with credits set to 2, 3, or 4 might be possible
    Looking at the logs I can see that iphone 8 and 11 behave a bit differently:
    It looks like the second to last packet don't have the MD bit set on iphone 11, in other words it is as if the last 2bytes is not ready in the link layer of the host on iphone 11 yet, while it is ready on iphone 8. This cause the transfer to be slower on iphone 11, since it wait until next connection interval to send the last 2bytes, but I do not know why there is a difference.
    Hope it helps,
    Kenneth
Children
Related