Good day
I use NRF52840 + SDK v17.0.2. My application relies on _gls example and mainly copies its security settings ( also uses peer manager ) except I use MITM protection for my characteristics and static pin code approach.
The root cause of issue is that behavior of NRF Connect for mobile (Android ) and for desktop differs. Our test app behaves correctly - I would say in the same way as NRF Connect for Android.
If shortly for Android ( NRF Connect app ) and iOS ( our test app ) during connection and bonding everything goes smoothly and I get expected result - I see pairing requests and system textbox for pin code input on both devices, after bonding is done I am able to connect without pin input.
The situation with NRF connect is different. It runs with 52840 usb dongle on Ubuntu, the version is 3.6.1 ( also tried 3.6.0 ). I tried both options: with automatic security response and manual - the result is the same - I can not get pin request on the screen thus device can not bond
Despite of MITM flag set in NRF Connect - anyway I get: Collector did not use MITM, disconnecting
Please advise what did I miss or what am I doing wrong. 2 log files are attached ( RTT output )
Thank you
Android /iOS - OK flow
<info> app: Reset reason: 1 <info> app: Setting vector table to bootloader: 0x000F1000 <info> app: Setting vector table to main app: 0x00027000 <info> app: battery_service_init() completed: 0 <info> app: battery_service_init() completed <info> app: Device id: 4fd1919f9a9b83a6 <info> app: MAC address: f0:7f:1e:fa:9a:08, type: -1 <info> app: dis_service_init() completed: 0 <error> app_serial: uart_event_handle(): APP_UART_COMMUNICATION_ERROR -> 4 <debug> nrf_ble_lesc: Initialized nrf_crypto. <debug> nrf_ble_lesc: Initialized nrf_ble_lesc. <debug> nrf_ble_lesc: Generating ECC key pair <info> app_timer: RTC: initialized. <info> app_adc: adc_init() <info> app_indic: indicate INDICATE_IDLE = 0 <info> app_btn: button_configure: STATE_STARTUP <info> app_twi_manager: twi_manager_init() <info> app_pmic: global status 0x40 <info> app_pmic: ercflag 0x00 <info> app_state: set_ext_powered: FALSE, current state: STATE_ADVERTISING <info> app_indic: indicate INDICATE_CHARGE_UNPLUGGED <info> app_state: set_charging: FALSE <info> app_pmic: charge status 0x00 0x00 <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0. <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0. <info> app_serial_srv: on_ble_event: BLE_GAP_EVT_CONNECTED <info> peer_manager_handler: pm_handler_secure_on_connection: BLE_GAP_EVT_CONNECTED <info> peer_manager_handler: Connected, securing connection. conn_handle: 0 <info> app: ble_evt_handler: BLE_GAP_EVT_CONNECTED <info> app_state: state_set: STATE_CONNECTED <info> app_indic: indicate INDICATE_CONNECTED <info> app_btn: button_configure: STATE_CONNECTED <info> app_pmic: pmic_ir_enable( TRUE ) <info> app_pmic: pmic_ir_enable(): err_code 0 <info> app: pmic_ir_enable_callback <info> app: Data len is set to 0xF4(244) <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7 <info> app_serial_srv: on_ble_event: 58 <info> peer_manager_handler: pm_handler_secure_on_connection: event 58 <info> app: ble_evt_handler: 58 <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x0. <debug> nrf_ble_gatt: max_rx_octets: 27 <debug> nrf_ble_gatt: max_tx_octets: 251 <debug> nrf_ble_gatt: max_rx_time: 328 <debug> nrf_ble_gatt: max_tx_time: 2120 <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7 <info> app_serial_srv: on_ble_event: 36 <info> app: ble_evt_handler: 36 <info> app: pm_evt_handler(): 5 <info> app_serial_srv: on_ble_event: 18 <info> peer_manager_handler: pm_handler_secure_on_connection: event 18 <info> app: ble_evt_handler: BLE_GAP_EVT_CONN_PARAM_UPDATE <info> app_serial_srv: on_ble_event: 18 <info> peer_manager_handler: pm_handler_secure_on_connection: event 18 <info> app: ble_evt_handler: BLE_GAP_EVT_CONN_PARAM_UPDATE <info> app: pm_evt_handler(): 1 <info> app: pm_evt_handler(): 5 <info> app_serial_srv: on_ble_event: 19 <info> peer_manager_handler: pm_handler_secure_on_connection: event 19 <info> app: ble_evt_handler: BLE_GAP_EVT_SEC_PARAMS_REQUEST <info> app_serial_srv: on_ble_event: 18 <info> peer_manager_handler: pm_handler_secure_on_connection: event 18 <info> app: ble_evt_handler: BLE_GAP_EVT_CONN_PARAM_UPDATE <info> app_serial_srv: on_ble_event: 21 <info> peer_manager_handler: pm_handler_secure_on_connection: event 21 <info> app: ble_evt_handler: BLE_GAP_EVT_PASSKEY_DISPLAY <info> app: Passkey: 123456 <info> app_serial_srv: on_ble_event: 26 <info> peer_manager_handler: pm_handler_secure_on_connection: event 26 <info> app: ble_evt_handler: 26 <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding <info> app: pm_evt_handler(): PM_EVT_CONN_SEC_SUCCEEDED <info> app: Link secured. Role: 1. conn_handle: 0, Procedure: 1 <info> app_serial_srv: on_ble_event: 25 <info> peer_manager_handler: pm_handler_secure_on_connection: event 25 <info> app: ble_evt_handler: BLE_GAP_EVT_AUTH_STATUS <info> app: status=0x0 bond=0x1 lv4: 0 kdist_own:0x3 kdist_peer:0x3 <info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED <info> app_serial_srv: on_ble_event: 53 <info> peer_manager_handler: pm_handler_secure_on_connection: event 53 <info> app: ble_evt_handler: 53 <info> app_serial_srv: on_ble_event: 54 <info> peer_manager_handler: pm_handler_secure_on_connection: event 54 <info> app: ble_evt_handler: 54 <info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED <info> app_serial_srv: on_ble_event: BLE_GATTS_EVT_WRITE <info> peer_manager_handler: pm_handler_secure_on_connection: event 80 <info> app: ble_evt_handler: 80 <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update <info> app: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED <info> app: pm_evt_handler(): 14 <info> app_serial_srv: on_ble_event: 82 <info> peer_manager_handler: pm_handler_secure_on_connection: event 82 <info> app: ble_evt_handler: BLE_GATTS_EVT_SYS_ATTR_MISSING >
NRF connect for desktop - FAIL flow
<info> app: Reset reason: 1 <info> app: Setting vector table to bootloader: 0x000F1000 <info> app: Setting vector table to main app: 0x00027000 <info> app: battery_service_init() completed: 0 <info> app: battery_service_init() completed <info> app: Device id: 4fd1919f9a9b83a6 <info> app: MAC address: f0:7f:1e:fa:9a:08, type: -1 <info> app: dis_service_init() completed: 0 <debug> nrf_ble_lesc: Initialized nrf_crypto. <debug> nrf_ble_lesc: Initialized nrf_ble_lesc. <debug> nrf_ble_lesc: Generating ECC key pair <info> app_timer: RTC: initialized. <info> app_adc: adc_init() <info> app_indic: indicate INDICATE_IDLE = 0 <info> app_btn: button_configure: STATE_STARTUP <info> app_pmic: global status 0x40 <info> app_pmic: ercflag 0x00 <info> app_state: set_ext_powered: FALSE, current state: STATE_ADVERTISING <info> app_indic: indicate INDICATE_CHARGE_UNPLUGGED <info> app_state: set_charging: FALSE <info> app_pmic: charge status 0x00 0x00 <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0. <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0. <info> app_serial_srv: on_ble_event: BLE_GAP_EVT_CONNECTED <info> peer_manager_handler: pm_handler_secure_on_connection: BLE_GAP_EVT_CONNECTED <info> peer_manager_handler: Connected, securing connection. conn_handle: 0 <info> app: ble_evt_handler: BLE_GAP_EVT_CONNECTED <info> app_state: state_set: STATE_CONNECTED <info> app_indic: indicate INDICATE_CONNECTED <info> app_btn: button_configure: STATE_CONNECTED <info> app_pmic: pmic_ir_enable( TRUE ) <info> app_pmic: pmic_ir_enable(): err_code 0 <info> app: pmic_ir_enable_callback <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response). <info> app: Data len is set to 0xF4(244) <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7 <info> app_serial_srv: on_ble_event: 58 <info> peer_manager_handler: pm_handler_secure_on_connection: event 58 <info> app: ble_evt_handler: 58 <info> app: pm_evt_handler(): 5 <info> app: pm_evt_handler(): 1 <info> app: pm_evt_handler(): 5 <info> app_serial_srv: on_ble_event: 19 <info> peer_manager_handler: pm_handler_secure_on_connection: event 19 <info> app: ble_evt_handler: BLE_GAP_EVT_SEC_PARAMS_REQUEST <info> app_serial_srv: on_ble_event: 26 <info> peer_manager_handler: pm_handler_secure_on_connection: event 26 <info> app: ble_evt_handler: 26 <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Pairing <info> app: pm_evt_handler(): PM_EVT_CONN_SEC_SUCCEEDED <info> app: Collector did not use MITM, disconnecting <info> app: m_peer_to_be_deleted: 65535 <debug> app: Disconnected connection handle 0 <info> app_serial_srv: on_ble_event: 25 <info> peer_manager_handler: pm_handler_secure_on_connection: event 25 <info> app: ble_evt_handler: BLE_GAP_EVT_AUTH_STATUS <info> app: status=0x0 bond=0x0 lv4: 0 kdist_own:0x0 kdist_peer:0x0 <info> app: pm_whitelist_get returns 0 addr in whitelist and 0 irk whitelist <info> app: on_adv_evt: BLE_ADV_EVT_FAST <info> app_state: state_set: STATE_ADVERTISING <info> app_indic: indicate INDICATE_ADVERTISING <info> app_btn: button_configure: STATE_ADVERTISING <info> app_serial_srv: on_ble_event: BLE_GAP_EVT_DISCONNECTED <info> app: pmic_ir_disable_callback >