Quadrature_Decoder

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

Quadrature_Decoder

Jump to solution
1,739 Views
erik_ziel
Contributor II

Hello all,

I try to use the Quadrature Decoder Model-Based Design toolbox. 

encoder.PNG

First try doesn't work, but as I changed the prescale factor from 1 to 2 it works more or less as expected.

And is there a better explanation of these module? 

The build in help unfortunately doesn't explain all configurable parameters and what's there influence.

Another thing is the FTM counter counts in one direction, regadless of the turning direction from my rotation sensor.

Am I wrong with the assumption that counter increases and decreases depending from A and B channel?

Thanks for any help.

regards

Erik

0 Kudos
Reply
1 Solution
1,587 Views
erik_ziel
Contributor II

Hello Marius,

I used the example to setup my model and now it works, thanks for that.

The only thing is I didn't discover the difference in the moment, but that does not matter, it works now.

regards

Erik

View solution in original post

0 Kudos
Reply
3 Replies
1,587 Views
mariuslucianand
NXP Employee
NXP Employee

Hello erik.ziel@autoliv.com‌,

With our toolbox we provide a great example called ftm_qd_s32k14x. This example shows how the QD works either in Count and Direction or Phase A and Phase B mode on the S32K144EVB. You need to use the FreeMaster and to connect the pins like in the model description. 

However, the best explanation about the QD module, can be read from the S32K-Reference manual.

Long story short:

Quadrature Decoder – Count and Direction Encoding mode

In this mode, the phase B input value indicates the counting direction, and the phase A input defines the counting rate. The FTM counter is updated when there is a rising edge at phase A input signal.

pastedImage_2.png

Quadrature Decoder – Phase A and Phase B Encoding Mode

In this mode, the relationship between phase A and B signals indicates the counting direction, and phase A and B signals define the counting rate. The FTM counter is updated when there is an edge either at the phase A or phase B signals.

pastedImage_5.png

If you want to use the Count and direction Encoding Mode please also select this in the QD Mask, because in your example it looks like there is a bad setting.

Hope this helps you,

Marius

0 Kudos
Reply
1,588 Views
erik_ziel
Contributor II

Hello Marius,

I used the example to setup my model and now it works, thanks for that.

The only thing is I didn't discover the difference in the moment, but that does not matter, it works now.

regards

Erik

0 Kudos
Reply
1,587 Views
mariuslucianand
NXP Employee
NXP Employee

Hello erik.ziel@autoliv.com‌,

Are you talking about the difference from our example or the difference about the modes?

Best Regards, 

Marius

0 Kudos
Reply