Connect quadrature rotary encoder to iMX8M-Plus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connect quadrature rotary encoder to iMX8M-Plus

1,926 Views
vix
Contributor II

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

0 Kudos
Reply
7 Replies

1,654 Views
MPUUser
Contributor I

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.

0 Kudos
Reply

1,606 Views
vix
Contributor II

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

0 Kudos
Reply

1,599 Views
MPUUser
Contributor I

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.

0 Kudos
Reply

1,593 Views
vix
Contributor II

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.

0 Kudos
Reply

1,906 Views
vix
Contributor II

Hi @joanxie 

PWM is ok for driving DC motors.

But I wonder about the quadrature rotary encoder.

Can you give more details, please?

0 Kudos
Reply

1,898 Views
joanxie
NXP TechSupport
NXP TechSupport

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"

0 Kudos
Reply

1,915 Views
joanxie
NXP TechSupport
NXP TechSupport

you can use PWM to connect motor

0 Kudos
Reply