Hi! I'm working on HID mouse example on SDK 13.0.0. I'm supposed to use this as a low power media button control.
I've done a few modicifations on the code for power optimizations, such as setting TX power, and set the preferred connection paramaters slightly according to Android spec.
This setup has been operational for a good time now, but I seem to have issues connecting the nRF52 as peripheral to my Huawei P9 Plus, running Android 7.0.
The issue seems to be service discovery when the phone connects to the nRF52 initially. From the nRF log of the phone it seems like the service discovery suddenly stops, even a service refresh stops. I've cross-checked with a Samsung Galaxy S5 running Android 6.0.1, an iPhone with unknown iOS version, and a Windows 10 computer. All of them seem to connect to and function with the nRF52 without any issues. This is a non-constant problem, because I am sometimes able to succesfully connect to the device, and use it as a remote for the Huawei. When they are able to bond and succesfully do a service discovery I can have them operating for hours, even reconnecting after the Huawei has been out of reach is successfull.
Could this be a problem related to service discovery on Android 7.0? Any help would be appreciated.
The project file is located here:
https://github.com/petter15/ble_app_hids_mouse
nRF log from service discovery attempt on Huawei P9 Plus. Service discovery apparentally failed.
nRF Connect, 2018-03-21 nRF_media_ctrl (C4:CA:86:06:6B:7A) V 18:41:50.758 Connecting to C4:CA:86:06:6B:7A... D 18:41:50.759 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE) D 18:41:50.780 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 18:41:50.780 Connected to C4:CA:86:06:6B:7A D 18:41:50.781 wait(1600ms) V 18:41:52.400 Discovering services... D 18:41:52.400 gatt.discoverServices() D 18:41:52.421 [Callback] Services discovered with status: 0 I 18:41:52.425 Services discovered V 18:41:52.460 Generic Access (0x1800) - Device Name [R W] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) - Service Changed [I] (0x2A05) Client Characteristic Configuration (0x2902) Device Information (0x180A) - Manufacturer Name String [R] (0x2A29) - PnP ID [R] (0x2A50) Battery Service (0x180F) V 18:43:40.394 Refreshing device cache... D 18:43:40.395 gatt.refresh() (hidden) I 18:43:40.398 Cache refreshed V 18:43:40.400 Discovering services... D 18:43:40.400 gatt.discoverServices() D 18:43:40.406 [Callback] Services discovered with status: 0 I 18:43:40.409 Services discovered V 18:43:40.447 Generic Access (0x1800) - Device Name [R W] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) - Service Changed [I] (0x2A05) Client Characteristic Configuration (0x2902) Device Information (0x180A) - Manufacturer Name String [R] (0x2A29) - PnP ID [R] (0x2A50) Battery Service (0x180F) V 18:43:57.987 Refreshing device cache... D 18:43:57.987 gatt.refresh() (hidden) I 18:43:57.989 Cache refreshed V 18:43:57.989 Discovering services... D 18:43:57.989 gatt.discoverServices() D 18:43:57.999 [Callback] Services discovered with status: 0 I 18:43:58.001 Services discovered V 18:43:58.038 Generic Access (0x1800) - Device Name [R W] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) - Service Changed [I] (0x2A05) Client Characteristic Configuration (0x2902) Device Information (0x180A) - Manufacturer Name String [R] (0x2A29) - PnP ID [R] (0x2A50) Battery Service (0x180F) V 18:44:19.629 Refreshing device cache... D 18:44:19.629 gatt.refresh() (hidden) I 18:44:19.630 Cache refreshed V 18:44:19.630 Discovering services... D 18:44:19.630 gatt.discoverServices() D 18:44:19.633 [Callback] Services discovered with status: 0 I 18:44:19.635 Services discovered V 18:44:19.665 Generic Access (0x1800) - Device Name [R W] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) - Service Changed [I] (0x2A05) Client Characteristic Configuration (0x2902) Device Information (0x180A) - Manufacturer Name String [R] (0x2A29) - PnP ID [R] (0x2A50) Battery Service (0x180F) V 18:44:23.305 Refreshing device cache... D 18:44:23.305 gatt.refresh() (hidden) I 18:44:23.309 Cache refreshed V 18:44:23.309 Discovering services... D 18:44:23.309 gatt.discoverServices() D 18:44:23.319 [Callback] Services discovered with status: 0 I 18:44:23.321 Services discovered V 18:44:23.356 Generic Access (0x1800) - Device Name [R W] (0x2A00) - Appearance [R] (0x2A01) - Peripheral Preferred Connection Parameters [R] (0x2A04) - Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801) - Service Changed [I] (0x2A05) Client Characteristic Configuration (0x2902) Device Information (0x180A) - Manufacturer Name String [R] (0x2A29) - PnP ID [R] (0x2A50) Battery Service (0x180F)
Wireshark sniff file from connection between nRF52 and Huawei P9 plus. Connection succeeded and device operational.
nrf_media_ctrl_21.03.18_nRF52_P9Plus_fullfuctional_reference.pcapng
Wireshark sniff file from connection between nRF52 and Huawei P9 Plus. Three attemps of connecting were made. The two first failed, while the last connection attempt succeeded and was able to make the device operational.
nrf_media_ctrl_21.03.18_nRF52_P9Plus_start-failure_then_functional.pcapng