Advertiser and new connection makes data transmission speed slower.

Hello All,

I have a problem when I build my project from sample central_uart &  peripheral_uart.

I have two nrf5340 called A and BB scans the broadcast to A to establish a connection. Then A sends data to B which the speed could reach 1.2Mbps.

But when B starts to advertise, data transmission speed do4rops to 500-600kbps.

What's more, the data transmission speed drops to 300-400kbps when my phone connects B.

I wonder what caused this problem.

I build your project with CONFIG_BT_SCAN_WITH_IDENTITY=y.

Thank you.

static const struct bt_data ad[] = {
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
	BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
};

static const struct bt_data sd[] = {
	BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_NUS_VAL),
};

static void adv_start(void)
{
	struct bt_le_adv_param *adv_param =
		BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE |
				BT_LE_ADV_OPT_ONE_TIME,
				BT_GAP_ADV_FAST_INT_MIN_2,
				BT_GAP_ADV_FAST_INT_MAX_2,
				NULL);
	int err;

	err = bt_le_adv_start(adv_param, ad, ARRAY_SIZE(ad), sd,
			      ARRAY_SIZE(sd));
	if (err) {
		printk("Failed to start advertiser (%d)\n", err);
		return;
	}
}

Here is B's advertiser code.

static void adv_stop(void)
{
	int err;
	err = bt_le_adv_stop();
	if (err){
		printk("Failed to stop advertiser (%d)\n", err);
		return;
	}
}

Here is B's scanner code.

Parents
  • Hi,

    There is only a single radio, and it cannot receive and transmit at the same time. So when the peripheral advertises, that means that there less time for the connection (how much less depends on the advertising interval). Similarly, when your phone connects to the peripheral (B), it now has two connections, and there is even less time for the connection with A. Moreover, these are not synchronized as a peripheral has no influence over this, so here might be quite a lot of overlaps/collision of the connection events with the two connections.

  • Thank you for your answer.

    Is there any way to improve the data transmission speed of A and B when B has two connections?

  • Yes, there is. To maximize the throughout between the central (A) and the peripheral (B), you should ensure that B spends less time on other things like advertising and/or maintaining a connection with the phone (C) as well. So:

    1. Increase the advertising interval (this is only relevant when advertising, not sure if you do that when you have established the second connection).
    2. Use a longer connection interval on the second connection (between the peripheral B and phone C).
    3. Use a shorter event length on the second connection (between the peripheral B and phone C).
    4. Use slave latency on the second connection (between the peripheral B and phone C).

    Note that it is the central that decides the connection parameters, but you can configure the nRF with the preferred parameters, and most recent SDK examples will then request a connection parameter update with those parameters.

Reply Children
No Data
Related