This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

QEI on TivaC board - Velocity Capture Problem

Other Parts Discussed in Thread: ENERGIA

Hello All,


I managed to get QEI working on my TivaC board, for now using energia. It does work, but I have some questions:

I am configuring velocity capture with the following statement:

QEIVelocityConfigure(QEI0_BASE, QEI_VELDIV_1, 80000000 / 1632 * 60);

80000000 is the cpu clocks per second

1632 is my gearbox * encoder_ppr

60 is 60 seconds per minute to read rpm.

I also have a RPM measurement device so I can measure the RPM from outside. The above configuration does work and generate the correct results.


However if I use QEI_VELDIV_2 or higher, from what I understand reading documentation we would need to reduce the period (80000000 / 1632 * 60) by two by dividing it into 2.

But this will lead the velocity reading to be 1/4 of real value. Similar if we use the QEI_VELDIV_4 counter.

To get correct results, we would need to multiply the period by the value of veldiv.

Why is that? Would not we need to divide it by veldiv?

Best regards,

C.

  • Hello Can

    It may be an issue with the QEI module itself. I would need to check the module to confirm the same if the VELDIV_2 results in the same data as VELDIV_4

    Regards
    Amit
  • Hello Amit,

    VELDIV_2 does not result same data as VELDIV_4 - I misexpressed myself.

    P is for my case: (80000000 / 1632 * 60)

    using VELDIV_1 and P we get correct RPM: 140
    using VELDIV_2 and P/2 we get RPM: 140/4
    using VELDIV_4 and P/4 we get RPM: 140/16

    So the VELDIV works as a multiplier, instead of a divider. this is where I got confused, because if we use:

    VELDIV_2 and P*2 we get RPM: 140
    VELDIV_4 and P*4 we get RPM: 140

    which are the correct values.

    Best regards,
    Can
  • Hello Can

    Thanks for the clarification. And yes, when the divider is applied, then the resulting values needs to be multiplied.

    Regards
    Amit