"Driver Error" when trying BLE HIDS mouse example disabling SMP

Hi! 

I have a working example of BLE HIDs mouse in nRF52DK. I changed the HID report and works ok in Windows 10.

My problem is I need to connect to PC without confirming connection from MCU side. I tried disabling SMP and it connects automatically, but then after a few seconds, Windows shows "driver error"

Any suggestion? Is it possible to pair with Windows without SMP? Any way to use SMP and automatically accept connection? Any way to do not see the confirmation numbers from Windows?

Thank you!

Pedro.

  • Hi Hung,

    I've done several tests and the first time worked doing exactly same as you (Only comment these 2 lines, rest of the example untouched). But then never worked again.

    It can't connect and I see the following messages:

    I: BAS Notifications enabled
    Connected 00:1A:7D:DA:71:15 (public)
    Regular advertising started
    Security failed: 00:1A:7D:DA:71:15 (public) level 1 err 4
    I: BAS Notifications disabled
    Disconnected from 00:1A:7D:DA:71:15 (public) (reason 19)
    Directed advertising failed to start
    I: BAS Notifications enabled
    Connected 00:1A:7D:DA:71:15 (public)
    Regular advertising started
    Security failed: 00:1A:7D:DA:71:15 (public) level 1 err 4
    I: BAS Notifications disabled
    Disconnected from 00:1A:7D:DA:71:15 (public) (reason 19)
    Directed advertising failed to start

    The example is untouched except for display and keyboard callbacks that are commented.

    What can be happening? Why first time worked?

    Can be something related to BLE version (4.0) of my PC dongle adapter? If so, how can I modify the example to be compatible with older BLE versions?

    Thanks again and kind regards,

    Pedro.

  • Hi Pedro, 

    Could you give some more information on 

    Pedro said:
    the first time worked doing exactly same as you (Only comment these 2 lines, rest of the example untouched). But then never worked again

    When did it stopped working, is it when you disconnect the mouse from the PC , or it's when you turn off and on the mouse ? 
    Have you managed to re-connect after disconnect ? 


    And everything works fine if you enable passkey ? 

    In my test here it worked just fine even after turning off and on the mouse. 
    Have you tried to test on other PC just to check if it's the PC issue or it's the nRF5 issue ? 

  • When did it stopped working, is it when you disconnect the mouse from the PC , or it's when you turn off and on the mouse ?

    First, I tested a clean example in nrF52DK with display and keyboard callbacks commented out and worked fine. Then I copied exact that code to my project with custom board and also worked.

    Seeing it worked, I commited the project. Then I commented out some code about reading buttons to move the cursor and build and flashed the code, and stopped working.

    It was strange because that code had nothing related to BLE. I reverted the changes, and with the code exactly the same as before, it never worked again.

    I tried a new clean example with the DK, commented out the 2 lines and didn´t work.

    And everything works fine if you enable passkey ? 

    Yes, if I enable passkey it works. After disabling passkey I remove (unbond) the device from the PC.

    Have you managed to re-connect after disconnect ? 

    Yes, many times and always receive error in log.

    Have you tried to test on other PC just to check if it's the PC issue or it's the nRF5 issue ?

    I tried in 2 PCs (One with ble 5.2, other with 4.0) and with one mobile phone (not sure if hid mouse is compatible with android phone).

    I also tried with ncs v2.0.2 and ncs v2.3.0

  • Hi Pedro, 

    I would suggest to do a full erase of the chip before testing. On PC, in addition to remove bonding please also try reset the device. 

    Could you try capture a sniffer trace when the issue happen ? 

    The error:
    Security failed: 00:1A:7D:DA:71:15 (public) level 1 err 4
    means: 

        /** The requested security level could not be reached. */
        BT_SECURITY_ERR_AUTH_REQUIREMENT,
    This suggests that there is an issue with the level of security, most likely one of the peers require MITM protection which your device doesn't support (no display or keyboard). 

    This is pretty strange as most mouse doesn't have keyboard or display. 

    Could you clarify, on the first time when it worked, did you turn it off and on and it still worked ? I'm interested in if it can re-connect and re-encrypt the link when it worked. 
  • Hi Hung,

    I would suggest to do a full erase of the chip before testing.

    That was the problem! I thought when flashing from vscode and says in first step "Erase file" it erased the chip fully, but no. I "Erased all" from nordic programmer and then flashed again and now it works!

    I think it had in the memory some bond data from when it was paired using mitm and that was the problem.

    Can I suggest adding "Erase all" option in vscode pluggin?

    Again, thank you very much Hung. You've helped me a lot.

    Kind regards,

    Pedro.

Related