I've been working on using an nRF52 as a host for a PS/2 synaptics touchpad mouse (to integrate with BLE HID). I was able to get a correct mouse position using two GPIO pins (clock and data) while BLE was disabled.
Once I turned on BLE, many of my packets were corrupted. PS/2 is a very slow protocol (25-50 microsecond clock intervals) with a parity bit as its only consistency check. As it turns out, the softdevice that runs the BLE stack is known for stealing CPU cycles, which seem to be the culprit.
Before I go down a rabbit hole here, I wanted to throw a few questions out:
- Is there a way to put the BLE to sleep for a few milliseconds while I poll my PS/2 device, then wake it to send the mouse report? (doesn't seem likely but worth a shot).
- I'm not using interrupts for detecting the PS/2 clock pin (seemed like overkill at first). Could this help in my case or would the softdevice still take priority?
- Are there tweaks I can make to the BLE config or the softdevice to make it less chatty? I'd assume it should stay quiet until it's time to send data (I'm seeing packet loss just from BLE being enabled. Peered, connected, or advertising. No other data needs to be sent)
- Is a timeshared chip like nRF52 a bad fit for this project, or am I doing something wrong here? I would love to take advantage of nRF52's unmatched low power consumption.
The board is Adafruit Bluefruit nRF52832 Feather using the Adafruit libraries.