Build Environment - NCS 1.4.0
Board - nrf52840dk_nrf52840
Samples used - "central_hr" & "peripheral_hr"
Code changes - in "peripheral_hr" - src/main.c - replace the while(1) loop with the following code (disconnection attempt is made every 10 seconds)
while (1) {
static int count;
if ( !((++count%10)) ) {
if (default_conn) {
int err = bt_conn_disconnect(default_conn, BT_HCI_ERR_SUCCESS);
printk("Err RC = %d\n", err);
}
}
k_sleep(K_SECONDS(1));
/* Heartrate measurements simulation */
hrs_notify();
/* Battery level simulation */
bas_notify();
}
Expected behaviour -
- HR notifications are sent for 9 seconds.
- Disconnection is triggered on 10th second.
- Advertising resumes.
- Central scans and reconnects.
- Cycle repeats
Issues observed -
- Return code "err" is 0, but advertising does not start.
- Scanning does not resume on the central.
Note - When the same code is built with Zephyr 2.4.0 using the board "nrf52840dk_nrf52840", the code behaves as expected.