I use nRFConnect iOS APP to pair nRF52832 device. But it failed to show passkey dialog.
I use nRFConnect iOS APP to pair nRF52832 device. But it failed to show passkey dialog.
I have added the following configuration in prj.conf.
CONFIG_BT_FIXED_PASSKEY=y
CONFIG_BT_GATT_AUTO_SEC_REQ=y
CONFIG_BT_SMP=y
And I also add the following code in bt.c for static pairing
bt_passkey_set(123456); // in btInit()
bt_conn_set_security(conn, BT_SECURITY_L2); // in connected() callback function
Now nRFConnect iOS APP shows pairing request information. But it doesn't shows dialog for me to enter passkey 123456.
00> *** Booting Zephyr OS build v3.2.99-ncs2 ***
00> Starting button Test example
00> btInit() e
00> bt_passkey_set(123456)
00> _btReady(0) e
00> Bluetooth initialized
00> calling bt_le_adv_start() begin
00> calling bt_le_adv_start() end
00> _btReady(0) x
00> btInit() x
00> Starting button Test example
00> device_is_ready() ok
00> gpio_pin_configure_dt() ok
00> gpio_pin_interrupt_configure_dt() ok
00> Set up button at gpio@50000000 pin 27
00> button state=1
00> start a timer
00> Button pressed or released
00> Button pressed at 399162
00> Connected 76:DC:64:C8:9D:FD (random)[00:00:30.228,149] <wrn> bt_l2cap: Ignoring data for unknown channel ID 0x003a
00> Passkey for 76:DC:64:C8:9D:FD (random): 038263Press Button 1 to confirm, Button 2 to reject.[00:01:00.799,835] <err> bt_smp: SMP Timeout
00> Security failed: 76:DC:64:C8:9D:FD (random) level 1 err 9Pairing failed conn: 76:DC:64:C8:9D:FD (random), reason 9
I have changed .passkey_confirm to NULL as follows.
static struct bt_conn_auth_cb conn_auth_callbacks = {
.passkey_display = auth_passkey_display,
.passkey_confirm = NULL,
.cancel = auth_cancel,
};
Now nRFConnect iOS APP can show dialog for entering passkey. Thanks for your great support!