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.

[参考译文] MSPM0G3507:用于解决周期捕获问题的芯片更新时间表

Guru**** 2595800 points
Other Parts Discussed in Thread: MSPM0C1104

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1329678/mspm0g3507-timeline-for-silicon-update-to-resolve-the-period-capture-issue

器件型号:MSPM0G3507
主题中讨论的其他器件:MSPM0C1104

您好!

是否有芯片更新时间表来解决周期捕获问题?

谢谢。

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

    您好、Brian、

    链接文章中提到的权变措施是否有原因不适用于您的应用?

    此致、
    卢克

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

    Luke、您好!

    权变措施1 (手动复位计时器)由于手动复位延迟而出错、因此在高频率下无效。 权变措施2 (手动计算周期)可以精确工作、但在 ISR 中有很多额外的代码开销。 我从事实时系统工作、因此计时器在高频下的正确和准确运行至关重要。

    此致、

    布赖恩

      

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

    你好,大脑,

    器件修订没有当前时间表。 我建议使用软件权变措施来捕获周期。

    如果希望缩短时钟周期以减少软件开销、我建议直接从寄存器获取该值、或简单地从 GPTIMER 寄存器中提取数据。 为计时器加载加载值也会发生同样的情况。

    这里是一个我用于加快提取数据所需时间的示例。

    /*
     * Copyright (c) 2020, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    #include "ti_msp_dl_config.h"
    
    volatile uint32_t gCaptureCnt;
    volatile bool gSynced;
    volatile bool gCheckCaptures;
    uint32_t gLoadValue;
    
    volatile uint32_t start, end, calibration, time;
    
    int main(void)
    {
        volatile static uint32_t pwmPeriod;
        __attribute__((unused)) volatile static uint32_t pwmDuty;
    
        SYSCFG_DL_init();
    
        start = DL_SYSTICK_getValue();
        end = DL_SYSTICK_getValue();
        calibration = start - end;
    
        /*
         * This value is used to reload timer manually. Due to timer capture
         * limitation
         */
        gLoadValue = DL_TimerG_getLoadValue(CAPTURE_0_INST);
    
        /* Initialize capture global states */
        gSynced        = false;
        gCheckCaptures = false;
    
        /*
         * Forcing timers to halt immediately to prevent timers getting out of sync
         * when code is halted
         */
        DL_TimerG_setCoreHaltBehavior(
            CAPTURE_0_INST, DL_TIMER_CORE_HALT_IMMEDIATE);
        DL_TimerG_setCoreHaltBehavior(PWM_0_INST, DL_TIMER_CORE_HALT_IMMEDIATE);
    
        NVIC_EnableIRQ(CAPTURE_0_INST_INT_IRQN);
        DL_TimerG_startCounter(CAPTURE_0_INST);
        DL_TimerG_startCounter(PWM_0_INST);
    
        while (1) {
            while (false == gCheckCaptures) {
                __WFE();
            }
            gCheckCaptures = false;
    
            /*
             * Calculate PWM period and PWM duty cycle. IMPORTANT: These calculation
             * assume timer is running in DOWN counting mode
             */
            pwmPeriod = gLoadValue - gCaptureCnt;
            pwmDuty   = ((gLoadValue - DL_TimerG_getCaptureCompareValue(
                                         CAPTURE_0_INST, DL_TIMER_CC_0_INDEX)) *
                          100) /
                      pwmPeriod;
    
            __BKPT(0);
        }
    }
    
    void CAPTURE_0_INST_IRQHandler(void)
    {
        switch (DL_TimerG_getPendingInterrupt(CAPTURE_0_INST)) {
            case DL_TIMERG_IIDX_CC1_DN:
                if (gSynced == true) {
                start = DL_SYSTICK_getValue();
                //Getting the data from the struct directly, saves clock cycles
                gCaptureCnt = (CAPTURE_0_INST->COUNTERREGS.CC_01[1]) & GPTIMER_CC_01_CCVAL_MASK;
                    /*gCaptureCnt = DL_TimerG_getCaptureCompareValue(
                        CAPTURE_0_INST, DL_TIMER_CC_1_INDEX);*/
                end = DL_SYSTICK_getValue();
                    gCheckCaptures = true;
                } else {
                    gSynced = true;
                }
                /* Manual reload is needed to workaround timer capture limitation */
                DL_TimerG_setTimerCount(CAPTURE_0_INST, gLoadValue);
                time = start - end - calibration;
                break;
            case DL_TIMERG_IIDX_ZERO:
                /* If Timer reaches zero then no PWM signal is detected and it
                 * requires re-synchronization
                 */
                gSynced = false;
                break;
            default:
                break;
        }
    }
    

    通过直接访问、您可以节省一些时钟周期、我们的 driverlib 可以灵活地输入(哪些计时器、通道等)、这可能会导致额外的时钟周期来处理此问题。 通过执行直接访问、您将节省处理时间。

    此致、

    卢克

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

    谢谢 Luke。 我将尝试执行代码。 器件中的这种错误实际上使计时器难以用于实时系统。 看似疯狂、验证中未检测到这一点、并且没有计划修复错误。 不管怎样、我现在将尝试通过使用权变措施使部件达到所需的效果。 希望芯片将在将来的某个时候得到更新、并且计时器将按预期工作。 此致、Brian

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

    Luke、您好!

    我正在评估 xMSPM0C1104器件、我还注意到计时器"周期捕获"功能不起作用。 TI.com 上的勘误文档中没有这方面的数据。 您能否确认 MSPM0C 系列 也存在相同的问题。

    此致、

    戈兰

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

    尊敬的 Goran:

    我认为这 也会影响 MSPM0C1104、但让我来仔细检查一下。

    此致、
    卢克