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.

CCS/TMS320F28335: eQEP Speed Calculation in TMS320F28335

Part Number: TMS320F28335

Tool/software: Code Composer Studio

I'm using TMS320F28335 DSP board for PMSM speed control and I tried to implement the encoder part using eQEP module. Could anyone help me to clear my doubts regarding this:

1. How to test eQEP module to check whether it is working properly or not?

2. I have gone through the example code, but the logic behind it is still not clear to me. Can you please explain?

3. What is the relation between QPOSCNT and speed measurement?

4. What is the possible range of QPOSCNT variable and how can we represent it in graph?

  • 5. What are the expected values of QPOSCNT?

  • 1. The eqep_pos_speed example generates PWM signals and a GPIO index signal to simulate inputs from an encoder. You can use jumper wires to connect them to the EQEP input pins. See the External Connections section of eqep_pos_speed chapter the F2833x_DEV_USER_GUIDE.pdf for the actual pin numbers you need to connect.

    2 & 3. Have you read the chapter I mentioned in 1? Can you specify what parts aren't clear? It contains the equations that show where QPOSCNT is used in the calculation of the speed.

    4 & 5. QPOSCNT is counting up based on the inputs on A and B and resetting based on the index. If you put a breakpoint before the code that toggles the GPIO being used for the index signal, you'll see that the QPOSCNT is 3999 and 0 after the index toggle.

    Whitney

  • Also read the EQEP reference guide. I think some of the timing diagrams may help you understand what the example is doing with QPOSCNT and the unit time out.

    www.ti.com/.../sprug05
  • 1. We tried the eQEP example program and the speed calculation part is working properly. Thank you for your quick response.

    2. As you have mentioned in the reply, we placed the breakpoint with update view action for getting QPOSCNT. But, the value of QPOSCNT is incrementing after         3999. Could You please help us to rectify this?

    3. The motor currently using is an old one, so there is a lack of specification knowledge of the motor. Could You please suggest any method to find its pulse per revolution (PPR) value or mech_scale value?

  • Hello, have you made any progress in your debug? Are you able to see the QPOSCNT getting reset by the index value?

    Whitney
  • I have tried both the example programs : eqep_freqcal and eqep_pos_speed and these are working properly. Thank you for your suggestion.

    But when I tried to implement this on my PMSM FOC program code , it is not working properly.

    I made PWM 5th register for A and B and GPIO 10 for Z , then I found that these two above codes are working, but when I tried to implement these with motor feedback, the QPOSCNT value is randomly occurring between 0 and 3.
    I have tried to incorporate these codes in two different ways:
    (i) I called the function from PWM interrupt
    (ii) I called the function from encoder interrupt
    In both ways, I didn't get a satisfactory output.

    Can you please suggest any solution for this?

    Thank You
  • Have you checked the signals coming from your encoder on a scope to make sure that they look as expected? Can you tell if QPOSCNT isn't going beyond 3 because it's being reset too soon or if it's not receiving valid inputs to begin with?

    Whitney
  • Sir,

    Yes, I have checked A and B signals coming from the encoder and detected correctly, but due to high frequency switching of Z pulse, we couldn't observe it on the scope. Can you please give some method to see that pulse?

    No, the QPOSCNT value isn't going beyond 3.

  • You mean the pulse itself is too narrow to detect? I'm a little surprised that you could see A and B but no Z. Do you know how many PPR you're supposed to be getting?

    Whitney
  • PPR = 2048. Can you please tell some possible issues related to Z pulse detection?
  • I'm still a little confused by this statement you made earlier--"I have checked A and B signals coming from the encoder and detected correctly, but due to high frequency switching of Z pulse, we couldn't observe it on the scope..."

    Your Z pulse shouldn't be a higher frequency than your A and B frequencies...?

    Whitney