zmk icon indicating copy to clipboard operation
zmk copied to clipboard

Pixart PMW33XX driver implementation

Open Luberry opened this issue 3 years ago • 18 comments

Driver seems to function. 3389 srom must be included out of tree if you use it as we don't yet have permission to include it in zmk, however this driver should also work with the 3360 whose firmware we can include.

I used this repo for reference as it was an mit licensed 33xx implementation.

Luberry avatar Mar 08 '22 01:03 Luberry

Maybe this helps you: Nordic implemented a PMW3360 driver in their nrf-connect SDK which is based on Zephyr. As far as I've used it, the PMW3389 is quite similar to the PMW3360 so maybe most of the work has already been done?

http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/drivers/pmw3360.html https://github.com/nrfconnect/sdk-nrf/tree/main/drivers/sensor/pmw3360

marcoster avatar Mar 31 '22 16:03 marcoster

Maybe this helps you: Nordic implemented a PMW3360 driver in their nrf-connect SDK which is based on Zephyr. As far as I've used it, the PMW3389 is quite similar to the PMW3360 so maybe most of the work has already been done?

http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/drivers/pmw3360.html https://github.com/nrfconnect/sdk-nrf/tree/main/drivers/sensor/pmw3360

That license is not compatible with ZMK, anyone looking to contribute drivers to ZMK should avoid reviewing/referencing anything in NCS.

petejohanson avatar Mar 31 '22 16:03 petejohanson

Maybe this helps you: Nordic implemented a PMW3360 driver in their nrf-connect SDK which is based on Zephyr. As far as I've used it, the PMW3389 is quite similar to the PMW3360 so maybe most of the work has already been done?

http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/drivers/pmw3360.html https://github.com/nrfconnect/sdk-nrf/tree/main/drivers/sensor/pmw3360

That license is not compatible with ZMK, anyone looking to contribute drivers to ZMK should avoid reviewing/referencing anything in NCS.

Yeah exactly this. That's why I'm writing a clean room implementation. I'll probably make some progress on it this weekend. Been busy with other things.

Luberry avatar Mar 31 '22 16:03 Luberry

Ah sorry, the old licensing pitfall... sad that chip vendors always use such licensing terms for such usefull stuff - when I used the pmw3389 it was really hard to find a satisfying implementation...

marcoster avatar Apr 04 '22 20:04 marcoster

The driver is working in both polling and interrupt driven mode with a pmw3389, but i want to wait until my 3360 hardware comes in so i can test it with the one we actually have permissions to use the srom prior to resolving the WIP status. I guess we probably actually want to merge this into the mouse pr when we do merge it.

Luberry avatar Apr 17 '22 16:04 Luberry

Tested with both the pmw3389 and the pmw3360. Thanks @Nicell for at least getting us permission for the 3360 srom.

Luberry avatar Apr 21 '22 12:04 Luberry

Thanks @Nicell for at least getting us permission for the 3360 srom.

For reference, here is an unsigned version of the consent letter between PixArt and me (Nice Technologies/Nice Keyboards).

3360-SROM-Consent-Letter-Unsigned.docx.pdf

I have the signed copy on file. If a signed copy is required, please contact me directly.

Nicell avatar Apr 22 '22 00:04 Nicell

Hello, I'm curious why this PR has been in limbo for nearly nine months?

bullwinkle3000 avatar Jan 17 '23 23:01 bullwinkle3000

Can someone review this PR. I'm really interested in this feature

bernhardfrenking avatar Aug 18 '23 17:08 bernhardfrenking

Can someone review this PR. I'm really interested in this feature

There's a whole world of pointer work that's in limbo. I am not really interested in merging additional drivers that add more maintenance work (for things like Zephyr upgrades) until the core pointer infrastructure (HID, event structure, etc) is ready. That work I'll hopefully poke at here and there soon

petejohanson avatar Aug 18 '23 17:08 petejohanson

Is there any example how to enable it in config?

meteozond avatar Jun 26 '24 12:06 meteozond

Searching code over github gave me some examples by @UniqueDing one and @ALpotato another. Using @theninj4 rebased branch after some imports and names fixes, I've managed to get my pmw3360 successfuly initialized (product and firmware id passed and there is red light now), but there are a lot of questions about motswk-gpios and callbacks. Is motswk=Motion pmw3360 pin? If so callbacks never fired, even after my Motion pin goes low after motion :(

meteozond avatar Jul 03 '24 13:07 meteozond

@meteozond I'm interested in this as well. Did you get it to work or was it just compiled without problems?

sommerper avatar Sep 19 '24 18:09 sommerper

@sommerper huh - I've spent a lot of time getting it work: I've managed to fix and compile rebased @theninj4's version. Even sensor firmware was successfully flashed. That it is all, callback never fired :(

I've tried @ALpotato's fork - but it gets some fatal errors at startup + reboot loop with my gpio configuration :(

I've recently tried circuitpython + kmk + pmw3360 driver and it worked! Unfortunately it doesn't use motion callback so will drain you battery fast.

meteozond avatar Sep 20 '24 06:09 meteozond

@sommerper huh - I've spent a lot of time getting it work: I've managed to fix and compile rebased @theninj4's version. Even sensor firmware was successfully flashed. That it is all, callback never fired :(

I've tried @ALpotato's fork - but it gets some fatal errors at startup + reboot loop with my gpio configuration :(

I've recently tried circuitpython + kmk + pmw3360 driver and it worked! Unfortunately it doesn't use motion callback so will drain you battery fast.

You probably want to switch to using bullwinkle3000's module.

Note that since ZMK is now based on Zephyr 3.5, you no longer need to follow the instructions to update the build.yml workflow.

lesshonor avatar Sep 23 '24 21:09 lesshonor

@meteozond Thanks for letting me and other know! That saved me a lot of time knowing now that it doesn't work. Kinda sad though that I might have to switch to qmk now that I have refined my zmk setup over a few years!

sommerper avatar Sep 29 '24 19:09 sommerper

@lesshonor The readme states Important to note that the PMW3360 is very power hungry compared to the PMW3610. If going fully wireless, you'll need big batteries and, even then, your battery life won't be great.

Wouldn't that be the same result that @meteozond achieved using KMK? As I understand it the module will never sleep but send data continuously?

sommerper avatar Sep 29 '24 19:09 sommerper

Wouldn't that be the same result that meteozond achieved using KMK? As I understand it the module will never sleep but send data continuously?

...You'd need to ask someone who knows anything about this hardware.

FWIW, bullwinkle3000's driver implements interrupt pin(s), so my uneducated guess is that PMW3360 is just inherently more power-hungry than PMW3610.

lesshonor avatar Sep 29 '24 20:09 lesshonor

Good news! I've just managed to run my pmw3360 with George Norton's driver despite some problems with smooth scrolling feature (it jumps to start/end only) - works like a charm.

PS: I've got bullwinkle3000's driver initialized and started getting some information from sensor - but pointer stacks in a left bottom conner :( I guess there are some interpretation problems.

meteozond avatar Jun 20 '25 08:06 meteozond