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: Query about ControlSuite eQEP example

Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hello!
Does anyone know how to increase the frequency at which the speed calculation is performed in the example "controlSUITE \ device_support \ F2837xD \ v200 \ F2837xD_examples_Cpu1 \ eqep_pos_speed"?
Thank you

  • Hi,

    Do you want to call the speed calculation function more often?
    It seems the frequency of the prdTick() function calls should be increased.
    This is generated by an interrupt from EPWM. You can increase the frequency of the PWM module.

  • Hello! Thanks for the reply, I will modify that.
    I want the calculation function to be performed more frequently, since it performs the speed calculation approximately every 200 interruptions.

  • Hi,

    Changing the PWM frequency will only speed up the simulated QEP inputs. Because in this test case PWM inputs are used to emulate QEP signals.

    //! GPIO pins (simulating QEP sensor) to QEP peripheral.
    //! - GPIO20/eQEP1A <- GPIO0/ePWM1A (simulates eQEP Phase A signal)
    //! - GPIO21/eQEP1B <- GPIO1/ePWM1B (simulates eQEP Phase B signal)
    //! - GPIO23/eQEP1I <- GPIO4 (simulates eQEP Index Signal)

    If I understand your need correctly - for making the calculation more frequent, you need to change the unit timer period.

    EQep1Regs.QUPRD = 2000000; // Unit Timer for 100Hz at 200 MHz
    // SYSCLKOUT

  • Hello!

    Yes, I placed the PWM pins on the eQEP inputs.

    I have modified the value in:

    EQep1Regs.QUPRD = 200000; // Unit timer for 100Hz to 200 MHz // SYSCLKOUT

    that is, I multiplied it by 0.1 and the speed reading was modified by a factor of 0.1 and I don't think it's the right thing since it modifies the actual "speed" reading.

    On the other hand, I don't see the "Index" resetting my origin.

    Thank you very much for your response, you are helping me.
  • Hi,

    As I said earlier EPWM1 in this example is used for emulating QEP inputs. And EPWM interrupt is used for triggering speed calculation.

    PieVectTable.EPWM1_INT= &prdTick;

    This interrupt is configured to be generated at every EPWM period.

    EPwm1Regs.ETSEL.all=0x0A; // Interrupt on PRD
    EPwm1Regs.ETPS.all=1;

    if you want interrupt to be generated on both counter zero and prd you can change EPwm1Regs.ETSEL.all=0x0B; 
    If you want this to be calculated more frequently you can use a different PWM module (configure at higher frequency) to trigger interrupts at a faster rate.

  • Hi,

    Did you try above suggestion? Can you explain your observation and why your issue is not resolved with this?

  • I make the interruption every 20 kHz and it shows me the same speed value 200 samples, that is, every 200 interrupts updates the value.

  • Hi,
    Why would you get a different speed value just because you are measuring more frequently? If you want to change the speed value, you have to change the frequency of the qep signal input.

  • Hello! Sorry, I make speed changes approximately every 50 samples and it doesn't detect it, but at 200 samples.

  • Hi,

    Can you please debug little further and come up with more specific observations?
    Is the QEP counts incorrect? Is the unit timer not behaving as per your expectation?
    Have you monitored the input signals on the scope? What is the expected speed vs. actual?
    Try to get to the root cause and it may help us identify and fix any s/w needed to achieve your goal.
    Your initial question was to be able to do the speed calculation more frequently - this should be accomplished by calling the function more often, as we discussed above. If that is not happening or resulting in some incorrect values, then it would be helpful to dig a little deeper and look at exact source of the error.

  • Thanks for your help! But I will abandon the project. Regards.

  • Hi,

    I hope you can come back to this project later on. Good luck.
    Please go ahead and close this thread. Feel free to start a new thread in future if you need any help.