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.

[参考译文] PROCESSOR-SDK-AM64X:实时时钟

Guru**** 2487425 points
Other Parts Discussed in Thread: TMDS64EVM

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1439116/processor-sdk-am64x-real-time-clock

器件型号:PROCESSOR-SDK-AM64X
主题中讨论的其他器件:TMDS64EVM

工具与软件:

您好!

我在没有操作系统的情况下运行 TMDS64EVM。

问题、关于实时计数器时钟。  


我正在从 A9000C 读取 高位、从 A90008读取低位。  


问题:
1.
highbits + low bits 将是 CPU 周期对吧?   例如:我具有十进制的高值0和低值200

这意味着 CPU 在当前时间内有200个周期在运行。  是这样吗。  


2.在800MHz  系统中、每个 CPU 周期应有1.25毫微/秒的性能?

而是每个 CPU 周期2纳秒。   我得到低值,让系统运行500毫秒,并得到低值, 我发现它需要  25万000 ,这意味着我的 CPU 运行2纳秒/每周期

那么、 问题可能出在哪呢? GTC 寄存器设置中有什么内容吗、我设置不正确?

谢谢。  












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

    您好!

    我希望您通读以下 E2E。

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1393314/processor-sdk-am62a-gtc-mcu-read-issue/5331678#5331678

    我来自客户曾使用 AM64x 的另一个论坛的其中一个回复:

    "

    是的、GTC 应从它拥有的最后一个计数值开始继续运行(即使在 JTAG 复位时也是如此)。 这在 AM64x TRM 中提到、我已附加一个片段。 如果您详细了解一下、那会很有帮助。

    此外、我认为您需要在软复位时将 GTC 计数器值重置为零、因此我编写了一个小应用程序、在 JTAG 复位+运行应用程序后会执行相同的操作。

    在上面的屏幕截图中、我已经实现了4个步骤、我建议您使用随附 C 文件中提到的流程来将计数器值重置为0。

    /*
     *  Copyright (C) 2021 Texas Instruments Incorporated
     *
     *  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 <stdio.h>
    #include <kernel/dpl/DebugP.h>
    #include <inttypes.h>
    #include "ti_drivers_config.h"
    #include "ti_drivers_open_close.h"
    #include "ti_board_open_close.h"
    #include <drivers/gtc.h>
    #include <drivers/soc.h>
    #include <drivers/gtc/v0/cslr_gtc.h>
    #include <kernel/dpl/ClockP.h>
    
    /*
     * This is an empty project provided for all cores present in the device.
     * User can use this project to start their application by adding more SysConfig modules.
     *
     * This application does driver and board init and just prints the pass string on the console.
     * In case of the main core, the print is redirected to the UART console.
     * For all other cores, CCS prints are used.
     */
    
    void GTC_disable(void);
    void GTC_clearCountRegisters(void);
    
    void hello_world_main(void *args)
    {
        int32_t retVal = SystemP_SUCCESS;
        uint64_t gtcCount1 = 0, gtcCount2 = 0;
        uint64_t clkRate = 0;
    
        /* Open drivers to open the UART driver for console */
        Drivers_open();
        Board_driversOpen();
    
        // This API is called to reset the 0th and 1st bit of the GTC0_GTC_CFG1_GTC_CFG1_CNTCR register
        GTC_disable();
        // Now clear the GTC0_GTC_CFG1_GTC_CFG1_CNTCV_LO and GTC0_GTC_CFG1_GTC_CFG1_CNTCV_HI registers
        GTC_clearCountRegisters();
    
        retVal = GTC_init();
        DebugP_assert(SystemP_SUCCESS == retVal);
    
        retVal = SOC_moduleGetClockFrequency(TISCI_DEV_GTC0, TISCI_DEV_GTC0_GTC_CLK, &clkRate);
        DebugP_assert(SystemP_SUCCESS == retVal);
    
        gtcCount1 = GTC_getCount64();
    
        ClockP_sleep(3);
    
        gtcCount2 = GTC_getCount64();
    
        DebugP_log("%lf is the time taken in seconds for testing GTC!!!\r\n",((Float64)((Float64)gtcCount2 - (Float64)gtcCount1) / (Float64)clkRate));
    
        Board_driversClose();
        Drivers_close();
    }
    
    
    void GTC_disable(void)
    {
        uint32_t baseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_GTC0_GTC_CFG1_BASE);
    
        HW_WR_REG32(baseAddr, 0);
    
        return;
    }
    void GTC_clearCountRegisters(void)
    {
        uint32_t baseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_GTC0_GTC_CFG1_BASE);
    
        HW_WR_REG32(baseAddr + CSL_GTC_CFG1_CNTCV_LO, 0); // Firstly, setting LO to 0
        HW_WR_REG32(baseAddr + CSL_GTC_CFG1_CNTCV_HI, 0); // Secondly, setting HI to 0
    
        return;
    }
    
    

    "

    此致、

    Vaibhav

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

    等待、  

    我还有一个问题。 怎么样,  CycleCounterP_getCount32();?

    与 GTC 计时器相比、CPU 周期似乎更准确。

    谢谢


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

    您好、Jun:

    [报价 userid="587615" url="~/support/processors-group/processors/f/processors-forum/1439116/processor-sdk-am64x-real-time-clock/5522022 #5522022"]CycleCounterP_getCount32 ()[/QUOT]

    大家也可以继续操作。

    我在这里已经有了它的常见问题解答: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1229699/faq-processor-sdk-am62x-profiling-cpu-cycles-in-application-using-cycle-counter

    此致、

    Vaibhav

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

    是的、我看到 GTC 时钟始终基于其他一些时钟并进行分频。 丢失(精度)
    CycleCounterP_getCount32()实际上是 CPU 周期

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

    是的、您的理解是正确的。

    正在关闭该主题帖。