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.

[参考译文] TMS570LS1227:何时发生 eQEP 位置计数溢出?

Guru**** 2382500 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1210322/tms570ls1227-when-does-the-eqep-position-count-overflow-occurs

器件型号:TMS570LS1227

尊敬的所有人:

在我们的应用中、位置计数器配置为在索引事件发生时的位置计数器复位模式下运行。

根据 SPNU515C 秒 21.4.1位置计数器工作模式、当位置计数器递增计数时发生溢出 更新 QPOSMAX 值。

根据测试结果、我们观察到溢出在位置计数器递增计数时发生 感应 QPOSMAX 值。

配置中的错误是否可能会导致观察到的行为? 我们假设 SPNU515C 是真正的参考。

提前感谢您的观看。

顺祝商祺、

路易斯

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Luis:

    Unknown 说:
    配置中是否有任何错误可能会导致观察到的行为? 我们假设 SPNU515C 是真正的参考。

    否、配置中不应出现任何错误、并且 在位置计数器递增计数时不会发生溢出   QPOSMAX 值上是一个预期行为。

    是的、SPNU515C 是对的。

    --

    谢谢。此致、
    Jagadish。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Jagadish:

    感谢您的快速响应。

    继续跟进您的回答、如果 SPNU515C 正确、那么您的回答与 SPNU515C 不匹配、也与我的说法不匹配。

    我的意思是 SPNU515C 几秒钟就可以完成了 21.4.1表示"[.] 当位置计数器递增计数时、发生溢出 更新 QPOSMAX 值。" 我(您也在回答中)说:"[.]当位置计数器递增计数时溢出 感应 QPOSMAX 值"

    观察到溢出 感应 在之后写入 SPNU515C 中的 QPOSMAX 值和 更新 QPOSMAX 值。

    您能否澄清一下您的答案?

    感谢您的时间和支持。

    此致、

    路易斯

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Luis:

    您是否可以共享代码以便我可以快速调试问题。

    --

    谢谢。此致、
    Jagadish。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Jagadish:

    当然可以! 但是、我 今天无法提供。 我明天很可能会跟大家分享。

    感谢您的时间和支持。

    此致、

    路易斯

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我明天很可能会分享它。

    谢谢 Luis。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Jagadish:

    很抱歉耽误你的时间。 下面您可以找到我们使用的初始化、

    static void fn_qep_reg_init_qepctl(qep_reg_t* p_qep_reg) {
        /**
         * Setup eQEP Control Register QEPCTL (SPNU515C, p. 920, p. 921).
         *
         * PCRM: Select Position counter Reset Mode:
         *
         * 0h = Position counter reset on any index event,
         * 1h = Position counter reset on the maximum position,
         * 2h = Position counter reset on the first index event.
         */
        BITMOD_CLR_BITS_16(0x3u, 12u, p_qep_reg->u16_qepctl);
    
        /* SEI: Enable & Select Strobe event initialization of position counter.
         *
         * 0h = Do nothing (action is disabled).
         */
        BITMOD_CLR_BITS_16(0x3u, 10u, p_qep_reg->u16_qepctl);
    
        /* IEI: Enable & Select Index event initialization of position counter.
         *
         * 0h = Do nothing (action is disabled),
         * 2h = Initializes the position counter on the rising edge of the QEPI
         *      signal (QPOSCNT = QPOSINIT).
         */
        BITMOD_CLR_BITS_16(0x3u, 8u, p_qep_reg->u16_qepctl);
    
        /* SWI: Enable / Disable Software Initialization of Position counter.
         *
         * 0h = Do nothing (action is disabled).
         */
        BITMOD_CLR_BIT_16(7u, p_qep_reg->u16_qepctl);
    
        /* SEL: Select Strobe event latch of position counter.
         *
         * The position counter is latched on the rising edge of QEPS
         * strobe (QPOSSLAT = POSCCNT). Latching on the falling edge is
         * done by inverting the strobe input using the QSP bit in the
         * QDECCTL register.
         *
         * The position counter is latched on the rising edge of QEPS strobe
         * (QPOSSLAT = QPOSCNT).
         */
        BITMOD_CLR_BIT_16(6u, p_qep_reg->u16_qepctl);
    
        /* IEL: Select Index event latch of position counter.
         * 1h: Latches position counter on rising edge of the index signal.
         */
        BITMOD_CLR_BIT_16(5u, p_qep_reg->u16_qepctl);
        BITMOD_SET_BIT_16(4u, p_qep_reg->u16_qepctl);
    
        /* QPEN: Quadrature position counter enable/software reset.
         *
         * Reset the eQEP peripheral internal operating flags/read-only
         * registers. Control/configuration registers are not disturbed by a
         * software reset.
         *
         * 0h: Reset the eQEP peripheral internal operating flags/read-only
         *     registers.
         */
        BITMOD_CLR_BIT_16(3u, p_qep_reg->u16_qepctl);
    
        /* Enable Position Counter (QPEN) (SPNU515C, p. 921).
         * QPEN = 1h: Enable Position Counter
         */
        BITMOD_SET_BIT_16(3u, p_qep_reg->u16_qepctl);
    
        /* QCLM: Select EQEP capture Latch mode (SPNU515C, p. 921).
         *
         * Latch on position counter read by CPU. Capture timer and
         * capture period values are latched into QCTMRLAT and QCPRDLAT
         * registers when CPU reads the QPOSCNT register.
         *
         * Latch on position counter read by CPU.
         */
        BITMOD_CLR_BIT_16(2u, p_qep_reg->u16_qepctl);
    
        /* Disable Unit Timer. */
        BITMOD_CLR_BIT_16(1u, p_qep_reg->u16_qepctl);
    
        /* WDE: eQEP watchdog enable.
         *
         * Disable eQEP watchdog timer.
         */
        BITMOD_CLR_BIT_16(0u, p_qep_reg->u16_qepctl);
    }
    
    With BITMOD* documentation:
    
    /**
     * \brief Helpers to set/clear/toggle multiple bits of `uint16_t` value
     *
     * `bits_` must be of unsigned integer type with max. width of `val_`.
     * `pos_` must be unsigned integer or non-negative enumeration type with value
     * < 16 - non-zero-MSB(`bits_`).
     * `val_` must be `uint16_t` type.
     */
    

    感谢您的时间和支持。

    此致、

    路易斯

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Luis:

    我想对 TRM 在这里所说的进一步说明。

    实际上、这里的计数器值将无法达到  QPOSMAX+1 ,它只能到达  QPOSMAX  在下一个脉冲时、将设置 over 标志、而计数器将复位。

    我希望这能够澄清您对 TRM 意义上的复位后计数器的疑问。

    --

    谢谢。此致、
    Jagadish。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Jagadish:

    感谢您的回复、很抱歉我的延迟。

    正如我在原帖中所提到的、我们了解文档中的内容、但在测试过程中、我们观察到了不同的行为。

    我们将重新检查并在稍后发布任何进一步的问题。

    总之、您是否发现所提供的初始化代码中存在任何问题或改进点?

    谢谢。此致、

    路易斯

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Luis:

    最后,您是否发现所提供的初始化代码存在任何问题或改进点?

    我在您的初始化代码中没有发现任何问题。

    稍后我们将重新检查并发布任何进一步的问题。

    好的、我们将等待您的反馈。

    --

    谢谢。此致、
    Jagadish。