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.

TMS320F28379D: Speed Measurement using eQEP module

Part Number: TMS320F28379D

Dear Sir, I am working on 3 Phase AC Induction Motor in which I coupled a QEP Encoder. I have to use only two lines of encoder because in actual motor there is only two line to measure the speed. 

The Encoder having 1024 Lines. I have taken the existing example code and I changed some of the variables according to my requirement as below: Base RPM = 3000, QEP lines = 1024. 

I fed these two signal to control card and runs the code but what I observed that the RPM speed is varying more them 50 rpm. I am not getting the stable speed at all. 

Please suggest me that what would be the best configuration for an eQEP module for me. 

Is this the hardware issue or my sampling is wrong. I also send the configuration I did.

// .9999 / 4096 converted to IQ26 fixed point format
#define MECH_SCALER 16383
// 2 pole pairs in this example
#define POLE_PAIRS 3
// Angular offset between encoder and Phase A
#define CAL_ANGLE 0
// See Equation 5 in eqep_ex2_calculation.c (4096*3000)
#define SPEED_SCALER ((((uint64_t)32 * DEVICE_SYSCLK_FREQ / 64) * 60) / (12288000))
// Base/max rpm is 6000rpm
#define BASE_RPM 3000

void initEQEP(void)

{
//
// Configure the decoder for quadrature count mode
//
EQEP_setDecoderConfig(EQEP1_BASE, (EQEP_CONFIG_1X_RESOLUTION |EQEP_CONFIG_QUADRATURE |EQEP_CONFIG_NO_SWAP));
EQEP_setEmulationMode(EQEP1_BASE, EQEP_EMULATIONMODE_RUNFREE);

//
// Configure the position counter to reset on an index event
//
EQEP_setPositionCounterConfig(EQEP1_BASE, EQEP_POSITION_RESET_IDX,0xFFFFFFFF);

//
// Enable the unit timer, setting the frequency to 50 Hz
//
EQEP_enableUnitTimer(EQEP1_BASE, (DEVICE_SYSCLK_FREQ / 50));

//
// Configure the position counter to be latched on a unit time out
//
EQEP_setLatchMode(EQEP1_BASE, EQEP_LATCH_UNIT_TIME_OUT);

//
// Enable the eQEP1 module
//
EQEP_enableModule(EQEP1_BASE);

//
// Configure and enable the edge-capture unit. The capture clock divider is
// SYSCLKOUT/64. The unit-position event divider is QCLK/32.
//
EQEP_setCaptureConfig(EQEP1_BASE, EQEP_CAPTURE_CLK_DIV_64,EQEP_UNIT_POS_EVNT_DIV_32);
EQEP_enableCapture(EQEP1_BASE);
}

  • Hi Ashutosh,

    How many counts/revolution does the encode output? Based on the configuration you have used it looks to be 4096/revolution (1024*4), is that correct?

    If so, than you need to change the resolution of eQEP to 2x.

    EQEP_setDecoderConfig(EQEP1_BASE, (EQEP_CONFIG_2X_RESOLUTION |EQEP_CONFIG_QUADRATURE |EQEP_CONFIG_NO_SWAP));

    Also, need few clarifications:

    1. How are you calculating the rpm, are you using the example (PosSpeed_calculate(&posSpeed))?

    2. What is the expected value of rpm, is it 3000?

    3. How are you giving index pulse to the micro, based on your information it looks like you are using 2 channel encoder with both channels 90deg phase shifted, correct?

    Regards,

    Nirav

  • Sir, 

    Yes the counts are 4096 / revolution. 

    Yes I am using the same example.

    I want to measure 2700rpm Maximum so I took 3000rpm as baserpm

     I am not using the index pulse because this is a low power setup I have the index pulse but in high power setup they dont provide the index . 

    I also not able to understand the both pre scaler. 

    Ashutosh Bhatt

  • Hi Ashutosh,

    Oh, ok, did changing the resolution to 2x help?

    The prescaler is for Capture Unit, refer chapter "eQEP Edge Capture Unit" in TRM for more details.

    Regards,
    Nirav
  • OK, I got it.

    One last query about QEP sensor that, Do we need any filter circuit between QEP sensor and MCU PINs. If we must put the circuit then please give me some application note or anything which helps me to design a filter. 

    Thanking You 

    Ashutosh Bhatt

  • Hi Ashutosh,

    You do not need to use filter circuit, instead you can use the GPIO filter on micro. and can configure the settings according to the noise in the system.

    Regards,
    Nirav