My device is working as a HID device. it's working on android and iPad but not work on macOS. It's can't solve the security procedure and returning error:<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 1
I was trying to connect to macOS 10.13.6 High Sierra using ble_app_hids_keyboard example. But I got the same error.
My device using NRF52810 with s112 and SDK 15.3.0. Ble_app_hids_keyboard project I had run on pca10040 board with s112 and SDK 15.3.0. The only thing which I changed in ble_app_hids_keyboard example is sdk_config.h
I do not have a High Sierra device at hand, but I tested using macOS Catalina and the ble_app_hids_keyboard example from SDK 15.3. Using that I am not able to reproduce the issue, and pairing succeeds as expected. Are you able to reproduce this with Catalina?
tested on old macbook air. not connected. Macbook writes it was not possible to create a pair, nothing happens on the device side.
I have tested several Mac's and MacOS versions now, and I am not able to reproduce this. This is basically an unmodified SDK example, just with the additional logging you have added. Do you still get problems using this hex (ble_app_hids_keyboard_pca10040_s132_merged.hex - include both app and SoftDevice)?
It is a bit difficult to read your RTT logs and some things seem missing, which may be because you probably have NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED set to 1 in the sdk_config.h. Please set this to 0.
The only problem I am able to reproduce is a few expected problems. When deleting the bonding information on the Mac but not on the nRF, I get this:
<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 133
And when deleting the donging information on the nRF only, I get this:
<info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102
I will describe each step that I take:1) I connect the PCA10040 1.2.4 board to the PC2) I launch j-flash Lite V6.60 and select nRF52832_xxAA3) Erase chip4) Download to Board - s132_nrf52_6.1.1_softdevice.hex5) Upload to Board - ble_app_hids_keyboard_pca10040_s132_merged.hex (what you sent me)6) LED1 started flashing7) I go to the iMAC version of Catalina I do not see in the list of bluetooth devices.8) When I started looking for the device on the android, LED1 stopped flashing. Restarted the PCA10040.9) I saw Nordic_Keyboard on the android, after half a minute I went to iMAC. The device is not visible, but LED1 is still blinking. Androyd still sees Nordic_Keyboard.10) Restarted the device and immediately started searching on the iMAC. The Nordic_Keyboard device has appeared. But the connection does not occur.11) The LED has stopped flashing. I restarted the PCA10040. I connected with android without problems.
First I wrote what I was doing, then I do it.
Then I set:
This is odd. I am still a bit unsure about how to read the log since it seems corrupted. Can you make sure to test with NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED set to 0, and upload the log again? Also, please attach a sniffer trace from the same test, so that we can see what is happening on air. This is particularly useful here since I find it hard to explain based on the logs and I am unable to reproduce the issue on my side.
Yes, I set the flag NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0.As for nRF Sniffer - I will write packets to Wireshark tomorrow or after tomorrow and forward them to you
I'm sorry for the pause.I scanned BLE packets in Wireshark.I downloaded an example of a HID keyboard with logs enabled on the PCA10040 board.Turned on Wireshark and started trying to connect.In one file, I connected with an error.In another file, I could not connect. I rebooted macOS and started connecting, but MacOS was constantly reconnecting to the device.
1777.Connected with error.pcapng
5315.several automatic reconnections.pcapng
P.S. I forgot to give the device MAC address - btle.advertising_address == ce:53:10:cd:68:c7
MAC address macOS device - 20:c9:d0:8d:0f:14 (High Sierra)
From the sniffer trace (5315.several automatic reconnections.pcapng) it looks like there is a problem with the packet reception. I don't know if it is just a problem with the sniffer, or also the communication between the DK (keyboard) and Mac, but you can see that almost all of the CONNECT_REQ packets has CRC errors. Interestingly there are no problems in the advertisement packets from the keyboard. Are you ablet o make a sniffer trace without this problem? Does this Mac function with other BLE devices? Or are you testing in a very noisy environment?
For your reference, I have uploaded a sniffer trace (ble_app_hids_keyboard_pca10040_s132_merged_catalina.btt) where I tested the ble_app_hids_keyboard_pca10040_s132_merged.hex attached to this case. I am still not able to see any problems.