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.

TMS320F280049C: QEP model phase error detection

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

Hello,

currently i'm using the launch-xl F280049C. In EQEP model i want to check the QEP phase error, but after all configuration and input signal feeding i'm not getting the phase error interrupt.

to configure this error i used QEP_ex5 _speed_derection of motor example which is available in the C2000 sdk

path: C:\ti\c2000\C2000Ware_4_01_00_00\driverlib\f28004x\examples\eqep

in this example i enabled the phase error interrupt along with the unit time out interrupt.

please help me to resolve this issue

  • Hi Siddaroodha,

    Can you post what driverlib functions you have added to the example code to enable the phase error interrupt?

    Regards,

    Peter

  • Hello Peter,

    sorry for the late response,

    driverlib function:  status=EQEP_getInterruptStatus(myEQEP0_BASE);

    in .syscfg file i enabled the phase error interrupt.

    Regards 

    Siddaroodha

  • Hi Siddaroodha,

    If you can directly provide your .syscfg file, that will assist me in debugging. Initially looking at this, I believe that those changes are sufficient to enable this phase error interrupt. Please ensure you are enabling all appropriate interrupt checkboxes in SysConfig as well. We also have the QFRC register where you can manually force a phase error interrupt, you can use this to test whether the interrupt is properly set up.

    Another question I have is what the waveforms look like which you passing into the QEP inputs to trigger the phase error interrupt. Can you provide the scope shots?

    Regards,

    Peter

  • Hello Peter,

    i'm not getting how to share the .syscfg file, but what and all initialization required to enable the phase interrupt I have done that.

    if i use QFRC register to force the interrupt then i'm getting the Phase interrupt. but if i feed the signals to the QEP inputs then i'm not getting the interrupt.

    initially using waveform generator i was giving signal for the QEP input signals. later i generated the QEP pulses using PWM module to minimize the phase synchronization issue and that signal i'm feeding as a QEP input signals.

    this signal is generated by using the PWM module

    Regards 

    Siddaroodha

  • QEP initialization source code

    void EQEP_init(){
    //myEQEP0 initialization
    
    // Disable, clear all flags and interrupts
    EQEP_disableInterrupt(myEQEP0_BASE,
    (EQEP_INT_GLOBAL |
    EQEP_INT_POS_CNT_ERROR |
    EQEP_INT_PHASE_ERROR |
    EQEP_INT_DIR_CHANGE |
    EQEP_INT_WATCHDOG |
    EQEP_INT_UNDERFLOW |
    EQEP_INT_OVERFLOW |
    EQEP_INT_POS_COMP_READY |
    EQEP_INT_POS_COMP_MATCH |
    EQEP_INT_STROBE_EVNT_LATCH |
    EQEP_INT_INDEX_EVNT_LATCH |
    EQEP_INT_UNIT_TIME_OUT |
    EQEP_INT_QMA_ERROR));
    EQEP_clearInterruptStatus(myEQEP0_BASE,
    (EQEP_INT_GLOBAL |
    EQEP_INT_POS_CNT_ERROR |
    EQEP_INT_PHASE_ERROR |
    EQEP_INT_DIR_CHANGE |
    EQEP_INT_WATCHDOG |
    EQEP_INT_UNDERFLOW |
    EQEP_INT_OVERFLOW |
    EQEP_INT_POS_COMP_READY |
    EQEP_INT_POS_COMP_MATCH |
    EQEP_INT_STROBE_EVNT_LATCH |
    EQEP_INT_INDEX_EVNT_LATCH |
    EQEP_INT_UNIT_TIME_OUT |
    EQEP_INT_QMA_ERROR));
    // Set the strobe input source of the eQEP module.
    EQEP_setStrobeSource(myEQEP0_BASE,EQEP_STROBE_FROM_GPIO);
    // Sets the polarity of the eQEP module's input signals.
    EQEP_setInputPolarity(myEQEP0_BASE,false,false,false,false);
    // Configures eQEP module's quadrature decoder unit.
    EQEP_setDecoderConfig(myEQEP0_BASE, (EQEP_CONFIG_QUADRATURE | EQEP_CONFIG_2X_RESOLUTION | EQEP_CONFIG_NO_SWAP | EQEP_CONFIG_IGATE_ENABLE));
    // Set the emulation mode of the eQEP module.
    EQEP_setEmulationMode(myEQEP0_BASE,EQEP_EMULATIONMODE_RUNFREE);
    // Configures eQEP module position counter unit.
    EQEP_setPositionCounterConfig(myEQEP0_BASE,EQEP_POSITION_RESET_MAX_POS,4294967295U);
    // Sets the current encoder position.
    EQEP_setPosition(myEQEP0_BASE,0U);
    // Enables the eQEP module unit timer.
    EQEP_enableUnitTimer(myEQEP0_BASE,1000000U);
    // Disables the eQEP module watchdog timer.
    EQEP_disableWatchdog(myEQEP0_BASE);
    // Configures the quadrature modes in which the position count can be latched.
    EQEP_setLatchMode(myEQEP0_BASE,(EQEP_LATCH_UNIT_TIME_OUT|EQEP_LATCH_RISING_STROBE|EQEP_LATCH_RISING_INDEX));
    // Set the quadrature mode adapter (QMA) module mode.
    EQEP_setQMAModuleMode(myEQEP0_BASE,EQEP_QMA_MODE_BYPASS);
    // Enables individual eQEP module interrupt sources.
    EQEP_enableInterrupt(myEQEP0_BASE,(EQEP_INT_PHASE_ERROR));
    // Configures the mode in which the position counter is initialized.
    EQEP_setPositionInitMode(myEQEP0_BASE,(EQEP_INIT_DO_NOTHING));
    // Sets the software initialization of the encoder position counter.
    EQEP_setSWPositionInit(myEQEP0_BASE,true);
    // Sets the init value for the encoder position counter.
    EQEP_setInitialPosition(myEQEP0_BASE,0U);
    // Enables the eQEP module.
    EQEP_enableModule(myEQEP0_BASE);
    }

    Regards 

    Siddaroodha

  • Hi Siddaroodha,

    You can simply attach the .syscfg in your project to your reply comment. This will make it easier to debug your configuration though i can see the code that is being called per your last message. Allow me some time to look through this.

    If you are able to generate the phase error interrupt using the QFRC register, then that means your interrupt is properly set up and the error comes in the detection of the phase error condition which generates this interrupt.

    There seems to be some noise on your input as the ramp is not very clean on both input signals. Can you try enabling input qualification (either 3 or 6 samples qualification)? This can help when the input may not be exactly synchronized or ramping at the same time? Do you have any filtering caps on your EPWM outputs?

     

    Regards,

    Peter

  • Hello Peter, 

    that problem is resolved now because of some connection issue i was not getting the interrupt.

    but i have another query, like if any one of the qep input signal is missed, weather we have any detecting mechanism?

    regards 

    Siddaroodha

  • Hi Siddaroodha,

    Thanks for the update and glad you are able to see the interrupt now

    I don't believe we have a detection mechanism for missed input signals. There are instances where users would only be feeding a single QEP input (example is for direction count mode or when using the quadrature capture module to simulate eCAP)

    Regards,

    Peter

  • Hello peter,

    thanks for confirming, but one thing are you suggesting me to use the example of direction count mode or using the quadrature capture mode to detect the missing signal.

    if these examples are used for detection of a missing qep signal, can you please provide me the application note.

    Regards 

    Siddaroodha

  • Hi Siddaroodha, 

    Sorry, you misunderstood my last message. I mean that we do not have any detection mechanism for missed pulse and it is up to the user to ensure that the pulses are correctly input into the eQEP module. 

    What I mean previously is that there are multiple instances when using the eQEP where a user may only be feeding a single signal into the eQEP. An example is when a user is wanting to use the quadrature capture module to simulate eCAP. In this case, only the QEPA input is required. Other instance is when direction count mode is enabled, where QEPA is the clock input and QEPB is the direction.

    Regards,

    Peter

  • Hello Peter,

    thanks for your support, it really helped me to solve the issue thank you.

    Regards 

    Siddaroodha