bt_att: ATT Timeout when using dynamic device name and advertising every 10 seconds

Hi all,

I'm working on a BLE peripheral using Zephyr and have run into an issue when enabling both dynamic device naming and long advertising intervals.

I enabled dynamic naming via CONFIG_BT_DEVICE_NAME_DYNAMIC and set the name at runtime with:

bt_set_name(device_name);

Then I start advertising with a slow interval (every ~10 seconds):

struct bt_le_adv_param connection_adv_param = {
    .interval_min = 0x3FFF, // ~10239.375 ms
    .interval_max = 0x4000, // ~10240 ms
    .options = BT_LE_ADV_OPT_CONNECTABLE,
    .id = 0,
    .sid = 0,
    .secondary_max_skip = 0,
    .peer = NULL,
};

struct bt_data ad[3] = {
    BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
    BT_DATA_BYTES(BT_DATA_SOLICIT16, BT_UUID_16_ENCODE(BT_UUID_CTS_VAL)),
    {
        .type = BT_DATA_NAME_COMPLETE,
        .data_len = strlen(device_name),
        .data = (const uint8_t *)device_name,
    },
};

bt_le_adv_start(&connection_adv_param, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

When both dynamic name and this slow advertising interval are used, I frequently get this error:

bt_att: ATT Timeout for device XX:XX:XX:XX:XX:XX (random). Disconnecting...

But if I disable CONFIG_BT_DEVICE_NAME_DYNAMIC, it works more reliably—though not completely stable either.

I'm wondering:

  • Is this related to the CTS timing out?

  • Is there a configurable timeout for CTS or ATT I can adjust?

  • Would it be better to reduce (shorter) the advertising interval after a connection is established?

  • Any best practice for using bt_set_name() with advertising?

Any tips would be appreciated!

  • Hi

    How frequently are we talking here? I don't see a specific reason why the advertising interval or dynamic name would cause disconnects more often than when not using this, so I'm suspecting some confirmation bias here. Can you say, for example with logs with time stamps or by counting manually, anything about how often you see the disconnects when:

    1. Dynamic name and slow advertising intervals are used
    2. Dynamic name and fast advertising intervals are used
    3. Static adv name and slow advertising intervals are used
    4. Static adv name and fast advertising intervals are used

    It could be that the connection timeout is triggered if you're advertising at very long intervals without letting the connection do anything in the meantime for example, so you can try increasing the connection supervision timeout.

    Best regards,

    Simon

Related