Getting HID over GATT BLE to work (PSoC4 BLE)? - Page 1
Forum section: electronics / general

author: Renate
author_rank: Super Contributor
timestamp: October 05, 2021, 10:15:06 pm
content: Well, I got over my SWD programming issues with a Cypress PSoC 4 BLE CYBLE-012011-00 SMT module.Why do they make life so complicated?https://www.eevblog.com/forum/microcontrollers/cant-get-swd-working-on-psoc4-ble-module/I can now program (and verify) the module.I'm using two examples directly and unedited from the Cypress examples, BLE HID keyboard, BLE HID mouse. Since an HID keyboard has more security concerns than some random GATT you are not allowed to write an app to interact directly with HID BLE. Normally you pair and let the system take over from there. On Android there is even a GUI slider for "Use as input device". But I can't make it pair. I can see the device in "pair new device" but clicking pair just makes it wobble then settle down. There's no indication of error. I've looked in logcat and can't find anything. Windows 10 doesn't even seem to notice the device.So, I went for my third OS, Raspberry Pi and bluetoothctl. I can see my device in scan. I can trust it. I try pairing and get:Code: Device 00:A0:50:17:13:6C Connected: yes Device 00:A0:50:17:13:6C Connected: no Device 00:A0:50:17:13:6C Connected: yes[BLE Mouse]# pair 00:A0:50:17:13:6CAttempting to pair with 00:A0:50:17:13:6C Device 00:A0:50:17:13:6C Connected: noFailed to pair: org.bluez.Error.AuthenticationCanceled Device 00:A0:50:17:13:6C Connected: yes Device 00:A0:50:17:13:6C Connected: no Device 00:A0:50:17:13:6C Connected: yesThe debug UART out of the module just says this in a loop:Code:CYBLE_EVT_ADVERTISINGCYBLE_EVT_GATT_CONNECT_IND: 0, 4CYBLE_EVT_GAP_DEVICE_CONNECTED: connIntv = 48 msCYBLE_EVT_AUTH_FAILED: 6CYBLE_EVT_GATT_DISCONNECT_INDCYBLE_EVT_GAP_DEVICE_DISCONNECTED: 5How is it that a $1 Chinese selfie clicker can get this right and I can't?Code: Device FF:FF:43:0F:62:9A AB Shutter3# trust FF:FF:43:0F:62:9A Device FF:FF:43:0F:62:9A Trusted: yesChanging FF:FF:43:0F:62:9A trust succeeded# pair FF:FF:43:0F:62:9AAttempting to pair with FF:FF:43:0F:62:9A Device FF:FF:43:0F:62:9A Connected: yesRequest authorization Accept pairing (yes/no): yes... services, etc ... Device FF:FF:43:0F:62:9A Paired: yesThe GAP security settings are as they came in the example, although I've tried a bunch of others.I also have the EZ-Serial in binary form and that programs and pairs perfectly.

author: Renate
author_rank: Super Contributor
timestamp: October 06, 2021, 06:30:32 pm
content: Update: I can get it to pair with a Raspberry Pi with a few pair attempts. I can get it to pair with an Android 8 phone with a dozen attempts. I can't get it to pair with Android 9 or 10 for lover or money. I can't even get Windows to acknowledge that it exists.

author: mon2
author_rank: Frequent Contributor
timestamp: October 06, 2021, 07:38:12 pm
content: I would also open a thread on their Cypress forum. Often they reply overnight with proper resolutions.

author: Renate
author_rank: Super Contributor
timestamp: October 07, 2021, 12:41:38 pm
content: Quote from: mon2 on October 06, 2021, 07:38:12 pmI did, but I figure that the people here are nicer.Also, I haven't heard a peep back.So, after beating on this for a solid two days...Using compiled, unedited examples the RF link is completely flakey, visibility, pairing and maintaining a connection is very difficult.Flashing the downloaded "EZ-Serial" image (no source available) appears instantly, pairs with one click and is solid.If someone has any pre-built images of BLE_HID_whatever to share for the CYBLE-012011-00 (it doesn't matter about pin assignments) that would be helpful.

author: Renate
author_rank: Super Contributor
timestamp: October 08, 2021, 01:28:40 pm
content: I never did get a response on the manufacturer's site.It turns out that a critical parameter wasn't set. Not even a unit specific trim value, just a device model trim value.QuoteCode:case CYBLE_EVT_STACK_ON:CY_SET_XTND_REG32((void CYFAR *)(CYREG_BLE_BLERD_BB_XO_CAPTRIM), 0xBCBC);Everything works fine now.