Loose quadrature encoder count

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

Loose quadrature encoder count

851 Views
yarannan
Contributor III

Hi there,

I am using MK20DX256VLL10 to read quadrature encoder.

The IDE and library i used for it is KDS3.0+KSDK1.3+PE.

The encoder resolution is 8192 ticks/revolution.

The maximum ticks the chip can return is unsigned 16 bits which is 65535.

The code updated the counter fine until I run the encoder in 1.2 m/s.

The encoder counter stop updating until I slow it down.

I probe the encoder with oscilloscope and the encoder can still send out signal not matter how fast i

turn.

The counter read from the functions stop updating around 2.8KHz.

 

I am wondering what could be possible causes for this?

Is it because I run encoder too fast so the code doesnt have time to react?

 

It will be really appreciated that if someone can answer this question.

 

Thanks,

Labels (1)
0 Kudos
4 Replies

683 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Yaran,

Regarding the interrupt issue, do you connect one of PhaseA or PhaseB to FTM_CHx  of another FTM module so that you can get precious speed in slow speed? If it is the case, the interrtupt triggering frequency will be about 3K*8.192K/(4*60)=100KHz, of course, the cpu is overloaded. At the time being, pls disable the capture interrupt.

If you use it to control BLDC, the tick number you need to generate interrupt to switch stator is 8192/(6*polar pair), assume that the polar pair of BLDC is 1, it is 1365, the interrupt frequency is 6*(3000/60)=300HZ, I think it is okay.

BR

Xiangjun Rong

0 Kudos

683 Views
yarannan
Contributor III

And the mechanical speed is around 3000rpm.

0 Kudos

683 Views
yarannan
Contributor III

Hi Xiangjun,

I was thinking it is because the encoder is too fast and always enter the interrupt and couldn't update the new number.

So i assumed that even i enter into debugger mode, since it is slower than normal running mode, and the FTM_CNT

would still be updated. I could give a try to see what happen. Please see datasheet of the encoder we used. It is 8192 ticks/revolution.

US Digital | Products » E6 Optical Kit Encoder

0 Kudos

683 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding your question, can you check if the FTM_CNT is updated or not when the motor spin fast in debugger?  If the FTM_CNT is updated, it is okay from hardware perspective. Pls disable the "Phase A Input Filter Enable" and "Phase B Input Filter Enable" feature by clearing the PHAFLTREN/PHBFLTREN bits in FTMx_QDCTRL register.

Can you tell me the mechanical speed and the encoder pulse number per revolution so that I can compute the FTM counting frequency? it seems that the FTM counting frequency should be less than core frequency/4.

BR

Xiangjun rong

0 Kudos