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

HID Keyboard Example Not Recognized by iPad

I programmed a PCA10001 with the HID Keyboard example and changed the preprocessor code from NRF6310 to PCA10001. The functions were tested according to the online HID Keyboard Application notes and everything worked as expected. (Note: The Application notes used were flagged as "old documentation" but it still worked.)

I then tried to connect the HID to an iPad. After enabling BT in Settings on the iPad the HID was not recognized. I thought the problem might be that the Company ID needed to be changed from Nodic's (x59) to Apple's (4C) but answers from a previous post say that the HID does not use Company ID so this should not be a problem. I installed the LightBlue app on the iPad and it does find the HID. Why can I not link to the iPad directly?

  • @Tom: Please test with the nRF Master Control Panel on iOS , you can download it from app store.

  • Installed MCP on iOS iPad Air (not Air 2). After enabling BT the device was found and says "Beacon Config" and displays RSSI. I expected "Keyboard Config" and not "Beacon Config".

    After pressing the Connect button it connects and shows Device Information and Battery Service. Selected Battery Service shows the UUID, Properties, Value and Descriptor. It appears to be working in MCP on iPad.

    Just went back to Settings and Nordic_Keyboard is now shown and connected.

    I closed MCP and removed power from the PCA10001 then the iPad indicated Nordic_Keyboard Not Connected (as expected). Applied power again and it indicated Connected.

    I opened Google and after pressing Button0 5 times "hello" appeared in the search box.

    It looks like it is now working but not sure what has changed. The only change was running MCP. How could that have enabled it? For now there is no problem. I will advise you if something changes.

  • @Tom: It's explainable. If you don't enable IS_SRVC_CHANGED_CHARACT_PRESENT = 1 , the iOS device will make an assumption that your device will never change the services table. And it will cache your attribute table and keep thinking your device is the beacon. MCP when connect to the device will force the iOS device to update the advertising packet and the new attribute table.

    So, make sure you turn on IS_SRVC_CHANGED_CHARACT_PRESENT in both beacon firmware and the keyboard firmware.

    However, this doesn't guarantee the phone will update the advertising packet (it guarantee the phone will update the attribute table though). So you may still need to use MCP to scan and connect if you want iOS device to remove the cached advertising packet.

  • I changed #define IS_SRVC_CHANGED_CHARACT_PRESENT 1 (was 0) in main.c but it still will not connect to the iPad (in Settings) unless the NRF MCP app is run and connected first.

    Also, when restarting the program in Debug, must connect through NRF MCP (does not automatically reconnect).

    After connecting the "hello" characters are not received by the iPad. This worked several days ago. The only changes from the original HID Keyboard example code for this test are: (1) changed board in preprocessor to PCA10001 and (2) changed IS_SRVC_CHANGED_CHARACT_PRESENT to 1.

    Runs through ble_hids_inp_rep_send() in ble_hids.c with good err_code (not DATA_SIZE, INVALID_STATE, or INVALID_PARAM errors).

  • @Tom: It's what I suspected, IS_SRVC_CHANGED_CHARACT_PRESENT = 1 doesn't guarantee that the iPhone would update the advertising packet. But you won't have problem if you don't change the advertising packet (switch to beacon), right ?

    If you simply stay in HID keyboard mode and restart the device, it would be reconnected automatically ?

    I would suggest you if you plan to switch between beacon and HID, you can try to change the address when switch to beacon, for example +1 to the address. This will trick the iPhone to think there are 2 different devices.

    Regarding the issue with "when restarting the program in Debug, must connect through NRF MCP" , could you capture a sniffer trace ? It good to check and compare if there is any difference and figure out why the phone didn't reconnect.

Related