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.

TMS320F28377S: QEP

Part Number: TMS320F28377S

I work with Mary West, so this question is related to the same system. We use the QEP in quadrature mode to read the encoder inputs. For the most part, this works flawlessly, but on two occasions during long multi hour runs, we've observed on one axis that the position indicated by the encoder is many counts off (> 1000) - both times, the magnitude of the error was virtually the same. Is there any way that the A and/or B inputs from the encoder could cause this? We've observed that disconnecting either A or B input causes the encoder output to hold its most recent value - but that's not what happened in our two observations. We read a totally different value.

Any insights would be appreciated

  • Hi Timothy,

    Can you clarify few things, so that it helps to understand the issue better?

    1. Are you using Index or Strobe Input to eQEP (i.e. eQEPI and eQEPS)?

    2. How do you know that position counter is off, do you read QPOSCNT at regular interval? 

    3. Are you using QCTMR as reference time? If so, do you latch QCTMRLAT on every QPOSCNT read? How do you handle UPEVENT?

    If you can send the eQEP configuration and the results observed, it will help narrow down the problem.

    Regards,

    Nirav

  • Hi Nirav -

    Here are the answers to your questions:

    1) We are not using the index or strobe lines for encoder motion tracking operations.  However, we use the strobe line during our motor homing process.  A sensor is hooked to this line and it is set up so that an encoder reading is latched when the sensor changes state.  This is done on an axis once per instrument power cycle.  The errors we are seeing occurred several hours after homing the axis.

    2) We read QPOSCNT at 100 µsec intervals.  We then convert the QPOSCNT to a referenced position in mm (real world units).

    We know the position counter is off because my observation and report of the axis position is a certain value (121 mm) at one instance and in the next instance, it reports that it is 134 mm.  It is still physically at 121 mm.

    3) We are not using the QCTMR register.  We are not using the QEP capture control.

    4) Here is the init code:

    //------Initialization states for EQEP Decoder Control Register - QDECCTL------
    #define QDECCTL_INIT_STATE     ( XCR_X2						/* b11:(0) External clock rate, 2x resolution: Count the rising/falling edge */ + \
    								 QSRC_QUAD_MODE	)/* b15,b14:(00) Quadrature count mode (QCLK = iCLK, QDIR = iDIR) */
    
    //-----------Initialization states for EQEP Control Register - QEPCTL----------
    #define QEPCTL_INIT_STATE      ( QEP_EMULATION_FREE				/* b15,b14:(10) Emulation suspend does not affect position counter */ + \
                                     PCRM_POSMAX					/* b13,b12:(01) Position counter reset on maximum position */ + \
    								 SEL_RISING	/* b6: (0) Strobe event latch of position encoder latched on rising edge - invert using QSP */ + \
                                     IEL_RISING					/* b5,b4:(01)Index event latched on rising edge of index signal */ + \
                                     QPEN_ENABLE					/* b3:(1) eQEP position counter is enabled */ + \
                                     UTE_DISABLE )					/* b1:(1) beQEP unit timer is disabled */
    
    //--Initialization states for EQEP Position-Compare Control Register - QPOSCTL-
    #define QPOSCTL_INIT_STATE      PCE_DISABLE					/* b12:(0) Position compare disabled */ 
    
    //----Initialization states for EQEP Capture Control Register - QCAPCTL--------
    // Used for doing slow velocity measurements with the encoder
    #define QCAPCTL_INIT_STATE     CEN_DISABLE					/* b15:(0) Disable eQEP capture */
    
    void ConfigureQEP(QEP* qep)
    {
        qep->qepReg->QDECCTL.all			= QDECCTL_INIT_STATE;												
        qep->qepReg->QEPCTL.all			= QEPCTL_INIT_STATE;												
        qep->qepReg->QPOSCTL.all			= QPOSCTL_INIT_STATE;				
        qep->qepReg->QCAPCTL.all			= QCAPCTL_INIT_STATE;												
        qep->qepReg->QPOSMAX			= qep->resData.posScaleCounts;	
        qep->countsPerElectRev			= qep->countsPerMotorRev / ((float)qep->numPolePairs) ;								
        qep->rawEncCount				= 0;													
        qep->previousRawEncCount			= 0;														
        qep->electricalAccum			= 0;																						
        if( qep->motor2EncoderSign == 1) 
        {
    	qep->qepReg->QDECCTL.bit.SWAP	= 1;
        }																
        qep->encoderHalfPeriod			= qep->resData.posScaleCounts / 2;					
        qep->qepReg->QCLR.bit.PHE			= 1;									
        qep->qepPhaseErrCount			= 0;													
        qep->countsPerElectRevInverse		= 1.0 / qep->countsPerElectRev;											
        qep->resData.posScaleCountsInverse	        = 1.0 / qep->resData.posScaleCounts;
    }

    Questions for you:

    I'm not worried about the QEP initialization.  We have successfully used this encoder system on many axes in several products.  For this particular axis, we are using a cable that is the suspected problem and are trying to understand what situation could cause the results we are seeing.  We disconnected one of the encoder lines and did not see this result.  In this case, the encoder count held its value as we manually moved the axis.  This is expected behavior.  What situations may cause  our intermittent bad reading?

  • Hi Timothy,

    Ok, I see, one situation that I can think of is, if the eQEP signal going into F28377s through the cable that you are suspecting is noisy then it could corrupt the position count. 

    Are you using any filter circuit in between sensor and micro? You can use GPIO filter and configure the settings according to the noise in the system. 

    Regards,

    Nirav

  • Hi Nirav -

    I'm currently using GPIO qualification. 

    QUALPRD2 = 20;  // This gives ~0.2 µs between samples

    GPAQSEL2 = 2;  // Six samples

    We were thinking noise on the suspect cable as well, but were interested in knowing if you had seen this on an axis or on a scope.

    Thanks -

    Mary

  • Hi Nirav,

          Thanks for your responses. In addition to Mary's GPIO qualification, the  A and B signals travel differentially on the cable before being converted back to single ended signals on the board containing the F28377S. I agree that noise could cause the problem, but going differential reduces the likelihood - plus I've looked at the signals on a scope and they look OK. If it is noise, then I'm surprised that we get nearly the same magnitude of error in both cases.

          Any possible suspects other than noise?

    Thanks,

    Tim

      

  • Hi Tim,

    Are you still seeing this issue? 

    Regards,

    Nirav

  • Yes. Any insights would be appreciated.

    Thanks,

    Tim

  • Hi Tim,

    Since you mentioned the eQEP configuration has worked fine, and the new cable installed is causing this issue, I am suspecting it to be System related. On our side we cannot emulate the exact same setup that you have so it is hard to duplicate the problem.

    Is it possible for you to monitor QPOSCNT continuously, at the same time monitor eQEP signals coming through the suspected cable, to see if QPOSCNT gets corrupted when their is a glitch on the line, this will help isolate the problem. 

    Regards,

    Nirav