This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Pairing fails with incorrect code entered error

I am using pca10001 board and started my development from nrf6310/s110/ble_app_hids_keyboard. SDK version is 6.0.0. I have successfully tested my device with (MCP) Master Control Panel v3.5.0.8226: I can discovery it, I can bond to the device and I can enable the services. The battery service is updating battery level. The key events are sent over bluetooth and the correct pattern is shown in MCP.

If I try to pair my device with Windows7HE x64 using LogiLink Bluetooth 4.0 dongle BT0015, I will get the error "Connection failed because an incorrect code was entered". This message appears without delay when I click to pair with my device.

For me it seems now that a pin code needs to be entered somewhere. Windows does want it but MCP does not. I have been searching and reading all day long about the pairing but I am still kind of lost. Any help is appreciated. Also for start, getting it pairing without any pin codes would be great.

  • I have following news, when I specify

    #define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_KEYBOARD_ONLY

    instead of BLE_GAP_IO_CAPS_NONE,

    Then windows is asking me to enter a code into my device. At the moment I can not do that.

  • I have found that W7 is not supporting this thing correctly. W8 must have available drivers. I managed to pair the device with Linux (FedoraCore20) which does have bluez-5.14. Bluez-4 does not support HoGP. Now I can also connect to the device but seems that I need to do more work on getting the key presses running.

  • I got my device to work with Linux: the key presses will reach into text editor. So, anyone who is struggling to get hid over gatt device to run, Linux is an option besides W8.

    My distribution is FedoraCore-20

    I used bluez-5.14

    kernel is 3.13.3

    uhid driver is compiled as module.

    However I had little struggle to get things running well. Below are some hints for the one who is following this path.

    Make sure that system is running as expected

    1# lsmod | grep uhid
    

    you must see here a line showing that uhid is loaded. If not, then issue

    1.1# modprobe uhid
    

    and verify again. If still nothing then you maybe do not have the module, check from

    /boot/config-<version> maybe the uhid is hardlinked into kernel.

    Check that you have deamon running

    2# ps ax | grep bluetoothd
    

    you must see that the daemon is running. Although for development, it might be good to see the debug log of the daemon:

    2.1# service bluetooth stop
    

    and start the daemon in debug mode and store the log into out.log and console

    2.2# /usr/libexec/bluetooth/bluetoothd -d -n 2&gt;&amp;1 | tee out.log
    

    There is nice command line utility for managing bluetooth devices:

    3# bluetoothctl
    

    help command is going to give you pretty much ideas what you can do

    3.1 [bluetooth]# help
    

    check the bluetooth radios with

    3.1 [bluetooth]# list
    

    and select the radio you want to use with

    3.2 [bluetooth]# select &lt;controllerMAC&gt;
    

    now you need to power it on

    3.3 [bluetooth]# power on
    

    to connect to your device the following needs to be done, scanning is a must

    3.4 [bluetooth]# scan on
    

    if you have seen the mac of your device

    3.5 [bluetooth]# scan off
    

    now pair with it

    3.6 [bluetooth]# pair &lt;deviceMAC&gt;
    

    and you need to connect

    3.7 [bluetooth]# connect &lt;deviceMAC&gt;
    

    To verify that the hid over gatt profile is in use, you can check if the /dev/uhid is open by the bluetoothd

    4# lsof | grep uhid
    

    you must see a line showing which process has opened the device.

    Now you are pretty much all set, start using your device and check the out.log if you need to.

    Good Luck !

Related