Cannot find Quadrature driver example

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

Cannot find Quadrature driver example

711 Views
PedroCastro
Contributor III

Hi,

I am using KDS3.2 and KSDK 1.3 with KMS and I need a quadrature driver in order to measure thevelocity of a wheel. There is no examples in KSDK 1.3 examples' folders and the qei_sys.h,created by KMS, is a little bit confusing yet. So, is there any examples regarding quadrature encoders?

If not, regarding qei_sys.h generated by KMS. I have some doubts:
1)  in function: void QEIS_init(uint16_t qeiMaxPosCount){

      ...

      /* set the maximum count value equal to (4 * encoderLines) - 1 */
      FTM_HAL_SetMod(FTM_ENCODER_BASE, qeiMaxPosCount);

}

What do you mean by encoder lines?

2) The function:

uint16_t QEIS_readPositionCounter(void)
{

return FTM_HAL_GetCounter(FTM_ENCODER_BASE);

}

gives me a position counter, that does not represent velocity.

How can I obtain the velocity from this API?

Thanks in advance!

Labels (1)
Tags (2)
0 Kudos
2 Replies

447 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Encoder Lines in Kinetis Motor Suite User's Guide

Encoder Lines.png

QEIS_readPositionCounter will not give you velocity.

QEIS_readPositionCounter.png

FRDMKV31F_SNSRDVEL_KDS_1_1_0_312

SNSRDVEL.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

447 Views
linestream-adam
Senior Contributor I

Pedro,

The quadrature encoder interface doesn't contain the velocity calculation.  This is done in the encoder block.  This block is abstracted from the type of encoder and thus can work with any encoder type.

You might be better served by looking at a sensored velocity example project for how to work with the encoder.

0 Kudos