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

Can't read characteristics of BLE HID service example

I'm trying to implement the HID service on a custom nrf52832 board, unfortunately I'm running into problems.

Here's what happens: Advertising, connecting to the board, service discovery, GPIOs (buttons & LEDs), reading the battery level, etc. all work great. I use nRF Connect to test this. However when trying to read HID characteristics (except for the protocol mode), the operation never finishes (the spinner keeps spinning). The log does not show any errors or other entries, except for the battery service updates that keep coming in. When I hit disconnect the spinner stops and the device is discoverable again.

The same happens when I use the "enable all services" menu item like described in the example. The HID device also doesn't produce any input in Android, even when connecting through settings and enabling "use for input device").

At first I suspected problems in my code, but now I'm running the unmodified examples (with -DBOARD_CUSTOM though) and have the exact same issue. I tried both the HID mouse and keyboard example. I'm using version 12.2 of the nRF5 SDK, though I'm getting the same result with 12.0.

Any ideas what's going wrong? I'd also appreciate any hints on how to further debug this.

Parents
  • FormerMember
    0 FormerMember

    When I test here, the HID example, ble_app_hids_keyboard (SDK 12.2.0, S132, v3.0.0), works fine. I don't see the behavior that you describe. Could you try the same hex file as I am using, and check if that hex file results in the same problem on your side: ble_app_hids_keyboard.hex (the hex file uses external LFCLK crystal as LFCLK clock source)

    Update 06.02.2017:

    After a closer look at the keyboard example, I see that the scheduler is only being used for the simulated battery measurement updates..

    I now think I understand what you mean. I re-tested: I connected my phone to the advertising keyboard using nRF Connect. When I then enabled the "report" characteristics, there was a disconnect. Looking at the log in nRF Connect, the disconnect occured due to a "Blueooth priviledged" permission. From this blog post, chapter 4.6, it happened because HID is in-built in Android naively.

    Therefore, please try the following: Connect to the keyboard device from the Bluetooth setting in the Settings menu on the phone. At the top bar on the phone there will be instructions on how to proceed (connect properly).

    To test that the keyboard is working (using a nRF52-DK), put the phone cursor in a search window, press button 1, and see that 'hello' will be written.

  • Okay, so maybe you could have a look at components/libraries/util/app_error.h, the app_error_log function has all the NRF_LOG calls commented out, clearly by mistake. Looks like some debug work has made it into the release. It's in both the 12.2 and 12.0 SDK.

Reply Children
No Data
Related