Other Parts Discussed in Thread: SYSCONFIG
Hello, we use the industrial comms SDK 11.00.00.13.
We also use the GTC to enable a time-measuring between cores. We just noticed when we compare the GTC-measured time with a time measured via two gpios we have like a 17% difference.
E.g. we measured 109 ms via two gpios set right after the start and end measurement of the GTC. The GTC measured 93117 us.
How we do everything:
/* the clock rate to calculate with */
static uint64_t clkRate = 0;
static bool initialized = false;
void implTimeMeasureInitialize()
{
uint32_t baseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_GTC0_GTC_CFG1_BASE);
clkRate = HW_RD_REG32((baseAddr + CSL_GTC_CFG1_CNTFID0));
/* initialization moved to bootloader, since mutliple cores calling this function will cause problems */
initialized = true;
}
uint64_t implTimeMeasureMicros()
{
if(initialized)
{
return (GTC_getCount64()/(clkRate/1000000));
}
else
{
return 0;
}
}
in the bootloader:
uint64_t clkRate = 0;
/* initialize GTC */
uint32_t baseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_GTC0_GTC_CFG1_BASE);
clkRate = HW_RD_REG32((baseAddr + CSL_GTC_CFG1_CNTFID0));
uint32_t value = 0;
value = HW_RD_REG32(baseAddr);
if( (clkRate == 0) || ((value & CSL_GTC_CFG1_CNTCR_EN_MASK) != CSL_GTC_CFG1_CNTCR_EN_MASK))
{
GTC_init();
// just for debuging
SOC_moduleGetClockFrequency(TISCI_DEV_GTC0, TISCI_DEV_GTC0_GTC_CLK, &clkRate);
}
else
{
// nothing
}
measuring:
uint64_t firstVal = 0; uint64_t secondVal = 0; uint64_t resultVal = 0; firstVal = implTimeMeasureMicros(); // set GPIO here // stuff happens secondVal = implTimeMeasureMicros(); // unset GPIO here resultVal = secondVal - firstVal; // <-- this value differs from the scope-measured time of gpio set and unset by 17%
What do we do wrong here?
best regards
Felix Heil





