hello!
I'm having problem when trying a repairing after clearing the bond information in the nrf52840
i using pairing via oob , i exchange oob between nrf52840 and RPI using a GATT char
err = bt_le_oob_get_local(BT_ID_DEFAULT, &ble_oob_local);
err = bt_le_oob_set_sc_data(conn, oob_local, oob_remote);
bt_conn_set_security(ble_conn, BT_SECURITY_L4);
and clearing bonding with
bt_unpair(BT_ID_DEFAULT, BT_ADDR_LE_ANY);
Which works between NRF52840 but between a nrf52840 and RPI it works once and then after clearing the bonding I must either reflash the nrf52840 or do a power-cycle (disconnect from the power supply) , a restart with `sys_reboot(SYS_REBOOT_COLD);` doesn't work
i got the following error if i try a repairing without power-cycle
<err> BLE: Security failed: E4:5F:01:02:05:24 (public) level 1 err 4
I want to understand why that happens only with the RPI, between nrf52840s i had no issues at all.
What's the difference between SYS_REBOOT_COLD vs a power-cycle ? what happens in the NRF52840 that allows a pairing with RPI again? thanks!
I tried the solution proposed here https://github.com/nrfconnect/sdk-nrf/blob/main/doc/nrf/releases_and_maturity/known_issues.rst?plain=1#L228C47-L228C61 didn't work
Here is my prj.conf
#
# BLE Configuration
#
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y
CONFIG_BT_GATT_CLIENT=y # can receive responses, indications and notifications. important for cert exchange
CONFIG_BT_DEVICE_NAME="Baremetallics Device"
CONFIG_BT_DEVICE_APPEARANCE=0
CONFIG_BT_ATT_PREPARE_COUNT=3
CONFIG_SETTINGS=y # Needed for CONFIG_BT_SETTINGS
CONFIG_BT_SETTINGS=y # BLE will take care of storing (and restoring) the Bluetooth state (e.g. pairing keys) and configuration persistently in flash
CONFIG_BT_SMP_APP_PAIRING_ACCEPT=y # Accept pairing requests from the application
CONFIG_BT_SMP_SC_PAIR_ONLY=y # Disables LE legacy pairing, so only Secure Connections pairing is used
CONFIG_BT_BONDABLE=y
CONFIG_BT_PRIVACY=y
CONFIG_BT_RPA_TIMEOUT=60
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_GATT_CACHING=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y # Needed for Bluetooth storage (Non-volatile storage)
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=1024
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_BT_RX_STACK_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=8192
### PSA settings
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_PSA_WANT_ALG_ECDSA=y
CONFIG_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT=y
CONFIG_PSA_WANT_ECC_SECP_R1_256=y
CONFIG_PSA_WANT_ALG_SHA_256=y
CONFIG_GPIO=y
CONFIG_INPUT=y # Enable buttons
#
# Application frameworks
#
CONFIG_SMF=y # State machine library
CONFIG_POLL=y # Asynchronous notification framework, used by Bluetooth
CONFIG_REBOOT=y # Reboot API
CONFIG_HW_STACK_PROTECTION=y
#
# DFU and MCUmgr configuration
#
## Info from docs.nordicsemi.com/.../dfu_mcumgr.html
CONFIG_MCUMGR=y # Enable mcumgr
CONFIG_MCUMGR_GRP_OS=y # Required for DFU
# Enable notifications for MCUmgr events and enable hooks for specific MCUmgr notifications
CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
CONFIG_MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK=y
CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y
CONFIG_MCUMGR_SMP_COMMAND_STATUS_HOOKS=y
CONFIG_MCUMGR_GRP_OS_RESET_HOOK=y
## MCUmgr dependencies
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_MCUMGR_TRANSPORT_BT=y # Enable the Bluetooth mcumgr transport (unauthenticated), TODO: check this
## Options to use MCUBOOT as DFU backend
CONFIG_MCUMGR_GRP_IMG=y # Enable the image management handlers, Required for DFU
CONFIG_MCUMGR_GRP_IMG_MUTEX=y # This will enable use of a mutex to lock the image group object access, preventing issues of concurrent thread (i.e. multiple transport) access
# DFU image manager, enables support to manage DFU images
CONFIG_IMG_MANAGER=y
# docs.nordicsemi.com/.../stream_flash.html
CONFIG_STREAM_FLASH=y # To allow stream writi progress during DFU
CONFIG_MCUBOOT_BOOTUTIL_LIB=y # Enable MCUboot utility library which implements functions required by the chain-loaded app and mcuboot
CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y
CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y ## No clear documentation on this, seems required for Android FOTA
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608
# Enable the storage erase command.
CONFIG_MCUMGR_GRP_ZBASIC=y
CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y