Other Parts Discussed in Thread: TMDXIDDK379D
Hello,
I am modifying tmdxiddk379d example code for my own fast current loop sensored FOC application. I was initially using a 2048 PPR encoder for my application, and everything was working as expected. I've now switched over to a 32,768 PPR encoder, and am having some issues.
It seems that there is a jump in the angle during operation. With each rotation I can hear a mechanical "pop", which I am guessing is a result from the field making a jump with the angle. You can see the jump in angle below.
If I go any faster than ~150 RPM, the motor losses synchronization and the control becomes unstable. However, when I deenergize and spin the rotor by hand, the angle is correctly reported in the waveform plotter, a smooth ramp up to 1.0 p.u., and then back down to 0.
Any insight into why this might be occurring with the new encoder would be helpful. I'm thinking it may have to do with the count value at the index being loaded into the counter at each rising edge of the index pulse, because the jump seems to happen once per revolution. However, I don't understand why the value would be incorrect. The initialization routine should take care of that.
Here are some of my QEP initialization parameters:
// Init QEP parameters qep1.LineEncoder = ENC_SLOTS; // set the number of slots in the encoder qep1.MechScaler = 0.25 / qep1.LineEncoder; qep1.PolePairs = POLES / 2; qep1.CalibratedAngle = 0; // Parameter: Raw angular offset // between encoder index and phase A // Configure the decoder for quadrature count mode, counting both // rising and falling edges (that is, 2x resolution) // For US Digital HB6M Encoder, A leads B for positive speed EQEP_setDecoderConfig(EQEP1_BASE, (EQEP_CONFIG_2X_RESOLUTION | EQEP_CONFIG_QUADRATURE | EQEP_CONFIG_NO_SWAP)); EQEP_setEmulationMode(EQEP1_BASE, EQEP_EMULATIONMODE_RUNFREE); // Configure the position counter to be latched on a unit time out // and latch on rising edge of index pulse EQEP_setLatchMode(EQEP1_BASE, (EQEP_LATCH_RISING_INDEX | EQEP_LATCH_UNIT_TIME_OUT)); // Configure the position counter to reset on a maximum position EQEP_setPositionCounterConfig(EQEP1_BASE, EQEP_POSITION_RESET_MAX_POS, (4 * qep1.LineEncoder) - 1); // Disables the eQEP module position-compare unit EQEP_disableCompare(EQEP1_BASE); // Enable the unit timer, setting the frequency to PWM Frequency EQEP_enableUnitTimer(EQEP1_BASE, QEP_UNIT_TIMER_TICKS); // Configure and enable the edge-capture unit. The capture clock divider is // SYSCLKOUT/128. The unit-position event divider is QCLK/32. EQEP_setCaptureConfig(EQEP1_BASE, EQEP_CAPTURE_CLK_DIV_2, EQEP_UNIT_POS_EVNT_DIV_256); // Enable QEP edge-capture unit EQEP_enableCapture(EQEP1_BASE);
Any ideas on how to resolve this issue would be much appreciated. The encoder code in the CLA is unmodified from the example. Thanks!