Efficient nrfx-based Quadrature Decoder for High-Speed Encoders on NRF5340

Hello,

I'm developing a project based on the NRF5340 and have encountered some challenges. As I'm relatively new to C, I'm trying to implement a quadrature (incremental) encoder decoder that accurately captures all four states of the signal. For example, with an encoder offering 1024 increments on two outputs, I should be able to obtain 4096 distinct positions.

I initially planned to use the Zephyr QDEC driver; however, as noted in this thread (https://devzone.nordicsemi.com/f/nordic-q-a/91398/qdec-peripheral-with-high-speed-encoder/384446), it seems too slow for my application. In addition to decoding the signal, I also need to reliably determine the direction of rotation.

Could anyone point me to a sample or provide guidance on using the nrfx-specific functions for this purpose—ideally in a way that minimizes CPU load?

Related