主题中讨论的其他器件:TMDXIDDK379D
您好!
我正在为自己的快速电流环路含传感器 FOC 应用修改 tmdxiddk379d 示例代码。 我最初为我的应用使用2048 PPR 编码器、一切都按预期工作。 我现在已经切换到32、768 PPR 编码器、并且遇到了一些问题。
在运行期间、角度似乎有一个跳变。 每次旋转时、我都会听到机械"砰"声、我猜这是场随角度跳转的结果。 您可以看到下面的角度跳跃。
如果转速超过~150RPM、电机将失去同步功能、控制将变得不稳定。 但是、当我用手使转子断电并旋转时、角度会在波形图仪中正确报告、平滑斜升至1.0 p.u.u.u.u.u.h、然后回到0。
了解新编码器可能会出现这种情况的原因会有所帮助。 我想它可能与在索引脉冲的每个上升沿加载到计数器中的索引上的计数值有关、因为每次旋转时跳转似乎会发生一次。 但是、我不理解为什么值会不正确。 初始化例程应负责处理这一问题。
以下是我的一些 QEP 初始化参数:
// 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);
关于如何解决这一问题的任何想法都将受到赞赏。 CLA 中的编码器代码从示例中未经修改。 谢谢!