Author Topic: Getting HID over GATT BLE to work (PSoC4 BLE)?  (Read 1111 times)

0 Members and 1 Guest are viewing this topic.

Offline RenateTopic starter

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Getting HID over GATT BLE to work (PSoC4 BLE)?
« on: October 05, 2021, 10:15:06 pm »
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: [Select]
[CHG] Device 00:A0:50:17:13:6C Connected: yes
[CHG] Device 00:A0:50:17:13:6C Connected: no
[CHG] Device 00:A0:50:17:13:6C Connected: yes
[BLE Mouse]# pair 00:A0:50:17:13:6C
Attempting to pair with 00:A0:50:17:13:6C
[CHG] Device 00:A0:50:17:13:6C Connected: no
Failed to pair: org.bluez.Error.AuthenticationCanceled
[CHG] Device 00:A0:50:17:13:6C Connected: yes
[CHG] Device 00:A0:50:17:13:6C Connected: no
[CHG] Device 00:A0:50:17:13:6C Connected: yes
The debug UART out of the module just says this in a loop:
Code: [Select]
CYBLE_EVT_ADVERTISING
CYBLE_EVT_GATT_CONNECT_IND: 0, 4
CYBLE_EVT_GAP_DEVICE_CONNECTED: connIntv = 48 ms
CYBLE_EVT_AUTH_FAILED: 6
CYBLE_EVT_GATT_DISCONNECT_IND
CYBLE_EVT_GAP_DEVICE_DISCONNECTED: 5
How is it that a $1 Chinese selfie clicker can get this right and I can't?
Code: [Select]
[NEW] Device FF:FF:43:0F:62:9A AB Shutter3
[bluetooth]# trust  FF:FF:43:0F:62:9A
[CHG] Device FF:FF:43:0F:62:9A Trusted: yes
Changing FF:FF:43:0F:62:9A trust succeeded
[bluetooth]# pair  FF:FF:43:0F:62:9A
Attempting to pair with FF:FF:43:0F:62:9A
[CHG] Device FF:FF:43:0F:62:9A Connected: yes
Request authorization
[agent] Accept pairing (yes/no): yes
... services, etc ...
[CHG] Device FF:FF:43:0F:62:9A Paired: yes
The 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.
 

Offline RenateTopic starter

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Getting HID over GATT BLE to work (PSoC4 BLE)?
« Reply #1 on: October 06, 2021, 06:30:32 pm »
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.
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Getting HID over GATT BLE to work (PSoC4 BLE)?
« Reply #2 on: October 06, 2021, 07:38:12 pm »
I would also open a thread on their Cypress forum. Often they reply overnight with proper resolutions.
 

Offline RenateTopic starter

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Getting HID over GATT BLE to work (PSoC4 BLE)?
« Reply #3 on: October 07, 2021, 12:41:38 pm »
I would also open a thread on their Cypress forum. Often they reply overnight with proper resolutions.
I 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.
 

Offline RenateTopic starter

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Getting HID over GATT BLE to work (PSoC4 BLE)?
« Reply #4 on: October 08, 2021, 01:28:40 pm »
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.
Quote
For older BLE components, the ECO capacitance trim values were automatically set in the generated source, hence all the projects worked as expected. It is mandatory to manually set the ECO capacitance trim value in the firmware or clock settings...
Code: [Select]
case CYBLE_EVT_STACK_ON:
    CY_SET_XTND_REG32((void CYFAR *)(CYREG_BLE_BLERD_BB_XO_CAPTRIM), 0xBCBC);
Everything works fine now. |O
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf