Hi,
I am writing an app for nRF52840 with sdk 17.0.2 and freeRTOS.
The device should be a peripheral which a android app should be able to connect to.
Everthing works but when I use an android app for connecting like "NRF Connect" the pairing popup on android shows twice.
I am using secure manager with following options
#define SEC_PARAM_BOND 1 /**< Perform bonding. */ #define SEC_PARAM_MITM 0 /**< Man In The Middle protection not required. */ #define SEC_PARAM_LESC 1 /**< LE Secure Connections enabled. */ #define SEC_PARAM_KEYPRESS 0 /**< Keypress notifications not enabled. */ #define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE /**< No I/O capabilities. */ #define SEC_PARAM_OOB 0 /**< Out Of Band data not available. */ #define SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */ #define SEC_PARAM_MAX_KEY_SIZE 16 /**< Maximum encryption key size. */ // Security parameters to be used for all security procedures. sec_param.bond = SEC_PARAM_BOND; sec_param.mitm = SEC_PARAM_MITM; sec_param.lesc = SEC_PARAM_LESC; sec_param.keypress = SEC_PARAM_KEYPRESS; sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES; sec_param.oob = SEC_PARAM_OOB; sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE; sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE; sec_param.kdist_own.enc = 1; sec_param.kdist_own.id = 1; sec_param.kdist_peer.enc = 1; sec_param.kdist_peer.id = 1;
I found a similar question but was instructed to open a new topic.
https://devzone.nordicsemi.com/f/nordic-q-a/73160/android-pairing-pop-up-appears-twice/336662#336662
This is the log of nRF Connect:
nRF Connect, 2021-10-29 xxx Mobile (C0:E3:F7:8A:4F:76) V 13:37:12.490 Connecting to C0:E3:F7:8A:4F:76... D 13:37:12.491 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 13:37:12.599 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 13:37:12.599 Connected to C0:E3:F7:8A:4F:76 V 13:37:12.603 Discovering services... D 13:37:12.603 gatt.discoverServices() D 13:37:12.636 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED D 13:37:12.739 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11) D 13:37:12.757 [Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3) I 13:37:13.532 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 13:37:13.678 [Callback] Services discovered with status: 0 I 13:37:13.678 Services discovered V 13:37:13.684 Generic Access (0x1800) - Device Name [R] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e) - RX Characteristic [W WNR] (6e400002-b5a3-f393-e0a9-e50e24dcca9e) - TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e) Client Characteristic Configuration (0x2902) D 13:37:13.684 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true) I 13:37:13.775 Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms) I 13:37:18.127 Connection parameters updated (interval: 11.25ms, latency: 0, timeout: 4000ms) D 13:37:18.132 [Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3) V 13:37:30.890 Disconnecting... D 13:37:30.890 gatt.disconnect() D 13:37:30.896 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0) I 13:37:30.896 Disconnected D 13:37:37.542 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10) I 13:37:37.542 Bonding failed D 13:37:37.573 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED D 13:46:26.833 gatt.close() D 13:46:26.838 wait(200) V 13:46:27.039 Connecting to C0:E3:F7:8A:4F:76... D 13:46:27.039 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 13:46:27.088 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 13:46:27.088 Connected to C0:E3:F7:8A:4F:76 V 13:46:27.122 Discovering services... D 13:46:27.122 gatt.discoverServices() D 13:46:27.124 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED D 13:46:27.235 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11) D 13:46:27.260 [Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3) I 13:46:28.198 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 13:46:28.364 [Callback] Services discovered with status: 0 I 13:46:28.364 Services discovered V 13:46:28.370 Generic Access (0x1800) - Device Name [R] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e) - RX Characteristic [W WNR] (6e400002-b5a3-f393-e0a9-e50e24dcca9e) - TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e) Client Characteristic Configuration (0x2902) D 13:46:28.370 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true) I 13:46:28.469 Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms) D 13:46:31.320 [Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3) I 13:46:32.563 Connection parameters updated (interval: 11.25ms, latency: 0, timeout: 4000ms) D 13:47:03.040 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10) I 13:47:03.040 Bonding failed D 13:47:06.036 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0) I 13:47:06.036 Disconnected D 13:47:06.086 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED D 14:18:46.683 gatt.close() D 14:18:46.688 wait(200) V 14:18:46.894 Connecting to C0:E3:F7:8A:4F:76... D 14:18:46.894 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 14:18:46.984 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 14:18:46.984 Connected to C0:E3:F7:8A:4F:76 V 14:18:46.990 Discovering services... D 14:18:46.990 gatt.discoverServices() D 14:18:47.012 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED D 14:18:47.082 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11) D 14:18:47.106 [Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3) I 14:18:47.871 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D 14:18:47.964 [Callback] Services discovered with status: 0 I 14:18:47.965 Services discovered V 14:18:47.970 Generic Access (0x1800) - Device Name [R] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e) - RX Characteristic [W WNR] (6e400002-b5a3-f393-e0a9-e50e24dcca9e) - TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e) Client Characteristic Configuration (0x2902) D 14:18:47.970 gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true) I 14:18:48.055 Connection parameters updated (interval: 45.0ms, latency: 0, timeout: 5000ms) D 14:18:52.035 [Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3) I 14:18:52.462 Connection parameters updated (interval: 11.25ms, latency: 0, timeout: 4000ms) D 14:19:24.902 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10) I 14:19:24.903 Bonding failed D 14:19:27.908 [Callback] Connection state changed with status: 0 and new state: DISCONNECTED (0) I 14:19:27.908 Disconnected D 14:19:27.959 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
Can anyone help me out?
Thanks, Andreas