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!