I need to conect a quadrature rotary encoder to an iMX8M-Plus processor (Cortex-M core), so that I can detect the position from an electric motor.
I downloaded the reference manual, and I see that there isn't a dedicated hardware peripheral.
Which is the best peripheral to use for this purpose?
GPT, PWM or GPIOs?
Is there any application note or reference design for this?
Thanks
Hi, I would like to revisit this questions. How do we connect quadrature rotary encoder? Or it is not supported by IMX8MPlus?
PWM is output to motor. Quadrature rotary encoder is input from motor to the MPU. Thanks.
You must configure three general purpose inputs (A, B and R) and handle all of them manually.
You can take inspiration from several github projects; as an example this one by DavidAntliff
Hi Vix,
Thanks for your suggestion. That looks like a software solution.
That means IMX8MPlus doesn't have a hardware decoder for the encoder.
What about single phase encoder where it only has 1 pulse? Can we use capture input?
Does it support 4 independent capture inputs as I have 4 encoders with 1 phase output?
Thanks.
That means IMX8MPlus doesn't have a hardware decoder for the encoder.
Right
What about single phase encoder where it only has 1 pulse? Can we use capture input?
You should read the Processo Reference Manual.
As far as I can see, only GPT1 has capture input capabilities (1 or 2 lines).
Not sure if it can be used to implement an encoder.
Hi @joanxie
PWM is ok for driving DC motors.
But I wonder about the quadrature rotary encoder.
Can you give more details, please?
don't have detailed example on imx8mp, but you can refer to this, add by yourself according to the link as below
"http://www.armadeus.org/wiki/index.php?title=Rotary_encoder_with_GPIOs"
"https://www.kernel.org/doc/Documentation/input/devices/rotary-encoder.rst"
you can use PWM to connect motor