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.

TMS320F28034: How to reset the eQEP module without watchdog reset?

Part Number: TMS320F28034

Hi.

I use TMS320F28034 to control the brushless motor with encoder.

I find that the eQep module occasionally fails to recognize the first index marker when the motor is just started.Therefore, the QPOSCNT cannot be reset normally when the index pulse edge is approaching.
In this case, I expect to be able to reset the eqep module and then start again.However, unless the whole chip is reset through the watchdog, I cannot reset the eQep module separately.How do I reset the eQEP module without watchdog reset?
Thank you for your reply and help!
  • void  POSSPEED_Init(void)
    {
    
    	EQep1Regs.QUPRD=300000;         // Unit Timer for 200Hz at 60 MHz SYSCLKOUT  每5ms生成一个时间事件
    
        EQep1Regs.QDECCTL.bit.QSRC=00;      // QEP quadrature count mode  //正交计数方式
    
        EQep1Regs.QEPCTL.bit.FREE_SOFT=2;			//仿真中断等不影响位置计数
        EQep1Regs.QEPCTL.bit.PCRM=00;       // PCRM=00 mode - QPOSCNT reset on index event  位置计数器中归零信号来时复位
        EQep1Regs.QEPCTL.bit.UTE=1;         // Unit Timeout Enable  单位时间事件使能
        EQep1Regs.QEPCTL.bit.QCLM=1;        // Latch on unit time out  单位时间事件时把位置计数器、捕获时间、捕获周期的值锁存到QPOSLAT, QCTMRLAT,QCPRDLAT中
        EQep1Regs.QPOSMAX=0xffffffff;
        //EQep1Regs.QEPCTL.bit.IEI = 0;	//for test
        EQep1Regs.QEPCTL.bit.QPEN=1;        // QEP enable
    
        EQep1Regs.QCAPCTL.bit.UPPS=6;       // 1/64 for unit position  低速时的捕获(转速计算):每64个位置脉冲(QCLK)计算一次转速  (1秒一转时16ms也会计算一次转速了)
        EQep1Regs.QCAPCTL.bit.CCPS=6;       // 1/64 for CAP clock  高速时的捕获(转速计算):每64个系统周期(1.07s)计算一次转速
        EQep1Regs.QCAPCTL.bit.CEN=1;        // QEP Capture Enable
    }

  • Hi Bingo,

    What encoder are you using and experiencing this with? Have you attempted to swap to a different encoder to avoiding missing this first index signal? This is not an expected behavior for the EQEP module. 

    In regards to your question about resetting the EQEP module, you should be able to reset the module itself without resetting the entire device. Let me refer to our documentation and I will get back to you on this

    Regards,

    Peter

  • Hi Peter,

    The zero pin eQepI of the incremental encoder I use will generate a 5us pulse signal every revolution.And From the oscilloscope, the pulse signal is not lost..It seems that the signals of pins A, B and I are normal.I still don't know the reason why "sometimes the first index marker can't be identified"

    In consideration of the project progress, I think resetting the eqep module is an acceptable option, so I request your help.

    Thanks!

  • Hi Bingo,

    You should be able to reset the eQEP module by writing to the software reset bit of the QEPCTL register, the description of which is shown below:

    Regards,

    Peter

  • Hi Peter,

    Unfortunately, I tried to reset QPEN and then reenable QPEN=1,However, it is still not possible to reset the position counter automatically when the return to zero pulse occurs.

    void ResetEQEPMoudle(void)
    {
    	/**EALLOW;
    	GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 0;
    	GpioCtrlRegs.GPADIR.bit.GPIO19 = 1;
    	EDIS;
    	GpioDataRegs.GPADAT.bit.GPIO19 = 1;
    	tMotorStatus.machineState = ERR_HALT_STATE;
    	if(tMotorStatus.EncoderPinErrFlag == FALSE)
    		for(;;);
    	else if(qep_posspeed.theta_raw&0x03!=0)
    		for(;;);*/
    	EQep1Regs.QEPCTL.bit.QPEN=0;
    	EQep1Regs.QUPRD=0;
    	EQep1Regs.QDECCTL.all = 0;
    	EQep1Regs.QEPCTL.all = 0;
    	EQep1Regs.QPOSMAX=0;
    	EQep1Regs.QCAPCTL.all = 0;
    	EQep1Regs.QCPRD = 0;
    	EQep1Regs.QPOSCNT = 0;
    	POSSPEED_Init();			//reenable QEP
    }

  • Hi Bingo,

    For clarification, do you mean that you are still experiencing the issue where the position counter doesn't reset on the first index pulse, or are there other conditions where the counter doesn't reset. I assume you are re-enabling the eQEP module in the POSSPEED_Init() function? 

    Which encoder are you using specifically? It would help to know to see why you are experiencing this erratic behavior.

    Regards,

    Peter

  • Hi Peter,

    In my application scenario, when the device is powered on, it will calibrate the position of the encoder relative to the stator winding after driving the motor for one revolution(under normal circumstances, the zero pin will generate a pulse to reset the count if the motor rotates for a circle).However,we found that the position counter occasionally did not reset despite the presence of the reset pulse eQEP.Therefore, I hope to reset the EQEP module(not only reset the position counter) in this case to restart the position calibration process.

    We use Infineon encoder chip TLE5012BE1000XUMA1.

    Thank you for your reply and help!

  • Hi Bingo, 

    Thanks for clarifying that further for me. Looking at your code, it looks like you've correctly configured the software reset and QPOSCNT reset for the eQEP module. You mentioned that the index pulse is 5us in length. Do you which signal, A or B, is the index pulse aligned to for your specific encoder? I would recommend maybe running the initial revolution at a slower speed and seeing if that may resolve your missed reset pulse. 5 us seems like more than enough time, but I'm curious to see if slowing down the revolution may help your issue

    Regards,

    Peter

  • Hi Peter,

    Thanks for your ideas and suggestions.

    This problem of 'the first index marker can't be identified occasionally 'has been solved by software pin filtering.I guess that the eQEP module identification error is caused by the interference signal on the Z signal line of the zeroing pin at the moment when the motor starts,and it seems that the first index marker identification error of the eQEP module cannot be reset.

        GpioCtrlRegs.GPAQSEL2.bit.GPIO20 = 2;   // Qualification using 6 samples (EQEP1A)  for test
        GpioCtrlRegs.GPAQSEL2.bit.GPIO21 = 2;   // Qualification using 6 samples (EQEP1B)
        GpioCtrlRegs.GPAQSEL2.bit.GPIO22 = 2;   // Qualification using 6 samples (EQEP1S)
        GpioCtrlRegs.GPAQSEL2.bit.GPIO23 = 2;   // Qualification using 6 samples (EQEP1I)

  • Hi Bingo,

    Glad you were able to resolve the issue you were seeing with the index pulse. Were you getting something like a QFLG[PCE] position counter error flag? You can reset this flag in software as it generates an flag that you manually have to clear in software. Nonetheless, it looks like you have found a good solution

    Regards,

    Peter