After updating from SDK V2.1.3 OTA to SDK V2.9.0, iOS cannot correctly read data such as the model number, but Android can read it normally.

Turn off Bluetooth in the system, turn it back on, and it can be read normally after connecting.
After updating from SDK V2.1.3 OTA to SDK V2.9.0, iOS cannot correctly read data such as the model number, but Android can read it normally.

Turn off Bluetooth in the system, turn it back on, and it can be read normally after connecting.
Hello,
Can you check whether the device actually restores the bond data and the CCCD when the new firmware boots? Are you seeing a new pairing dialog after the OTA/reboot?
I see that you have enabled CONFIG_BT_SETTINGS=y, but in the application, after enabling Bluetooth, you also need to call settings_load(). This call restores the bonds and CCCDs, see this here.
Try enabling the logs CONFIG_BT_LOG_LEVEL_DBG and CONFIG_SETTINGS_LOG_LEVEL_DBG and check if there are any log messages indicating that CCCD data is being loaded from flash after boot.
Kind regards,
Abhijith
Hi Menon,
Three devices are connected.
1. Android MAC: F0:05:1B:64:F7:C0 (public)
2. iOS MAC: 6C:3A:FF:11:53:B0 (public)
3. iOS MAC: 7C:04:D0:6C:A2:4A (public)
Two random addresses appeared:
1. 4B:4F:D8:FE:15:CA (random)
2. 47:CF:4D:30:CD:4A (random)
Then OTA was performed, updating from sdk-v2.1.3 to sdk-v2.9.0. After the OTA succeeded, the iOS devices could not communicate normally.
In sdk-v2.9.0, the battery service has a new characteristic: BT_GATT_CPF(&level_cpf).
Because iOS uses random addresses, there is no bond here, so the SC is not stored.
static void sc_save(uint8_t id, bt_addr_le_t *peer, uint16_t start, uint16_t end)
{
struct gatt_sc_cfg *cfg;
bool modified = false;
BT_WARN("peer %s start 0x%04x end 0x%04x", bt_addr_le_str(peer), start,
end);
cfg = find_sc_cfg(id, peer);
if (!cfg) {
/* Find and initialize a free sc_cfg entry */
cfg = find_sc_cfg(BT_ID_DEFAULT, BT_ADDR_LE_ANY);
if (!cfg) {
BT_ERR("unable to save SC: no cfg left");
return;
}
cfg->id = id;
bt_addr_le_copy(&cfg->peer, peer);
}
/* Check if there is any change stored */
if (!(cfg->data.start || cfg->data.end)) {
cfg->data.start = start;
cfg->data.end = end;
modified = true;
goto done;
}
modified = update_range(&cfg->data.start, &cfg->data.end, start, end);
done:
if (IS_ENABLED(CONFIG_BT_SETTINGS) &&
modified && bt_addr_le_is_bonded(cfg->id, &cfg->peer)) {
sc_store(cfg);
}
}
Hi Menon,
Three devices are connected.
1. Android MAC: F0:05:1B:64:F7:C0 (public)
2. iOS MAC: 6C:3A:FF:11:53:B0 (public)
3. iOS MAC: 7C:04:D0:6C:A2:4A (public)
Two random addresses appeared:
1. 4B:4F:D8:FE:15:CA (random)
2. 47:CF:4D:30:CD:4A (random)
Then OTA was performed, updating from sdk-v2.1.3 to sdk-v2.9.0. After the OTA succeeded, the iOS devices could not communicate normally.
In sdk-v2.9.0, the battery service has a new characteristic: BT_GATT_CPF(&level_cpf).
Because iOS uses random addresses, there is no bond here, so the SC is not stored.
static void sc_save(uint8_t id, bt_addr_le_t *peer, uint16_t start, uint16_t end)
{
struct gatt_sc_cfg *cfg;
bool modified = false;
BT_WARN("peer %s start 0x%04x end 0x%04x", bt_addr_le_str(peer), start,
end);
cfg = find_sc_cfg(id, peer);
if (!cfg) {
/* Find and initialize a free sc_cfg entry */
cfg = find_sc_cfg(BT_ID_DEFAULT, BT_ADDR_LE_ANY);
if (!cfg) {
BT_ERR("unable to save SC: no cfg left");
return;
}
cfg->id = id;
bt_addr_le_copy(&cfg->peer, peer);
}
/* Check if there is any change stored */
if (!(cfg->data.start || cfg->data.end)) {
cfg->data.start = start;
cfg->data.end = end;
modified = true;
goto done;
}
modified = update_range(&cfg->data.start, &cfg->data.end, start, end);
done:
if (IS_ENABLED(CONFIG_BT_SETTINGS) &&
modified && bt_addr_le_is_bonded(cfg->id, &cfg->peer)) {
sc_store(cfg);
}
}