Other Parts Discussed in Thread: TMS570LC4357
Hello,
I am trying to perform the Clock Monitor Test from the TI Safety Library on a RM57 / TMS570LC4357 and am not getting the expected results.
It is never getting the oscillator fail flag in the GBLSTAT register or the ESM. According to the CSDISSET and CSSTATUS, the oscillator is disabled. Does this test need to run prior to initializing any peripherals as the technical reference states that the clock will not be disabled until there are no active consumers.
Code:
void checkClockMonitor(void) { uint32_t ghvsrc_bk; /* Enable clock monitor range detection circuitry */ systemREG1->CLKTEST |= 0x03000000U; /* Backup register GHVSRC */ ghvsrc_bk = systemREG1->GHVSRC; /* Switch all clock domains to HF LPO */ systemREG1->GHVSRC = 0x05050005U; /* Disable oscillator to cause a oscillator fail */ systemREG1->CSDISSET = 0x1U; /* Wait till oscillator fail flag is set */ while((systemREG1->GBLSTAT & 0x1U) == 0U) { } /* Wait, Never gets passed this point */ if((esmREG->SR1[0U] & 0x800U) != 0x800U) { health_policy(PLATFORM_ERROR, TEST_ERROR_CLOCK_MONITOR); } else { /* Clear ESM flag */ esmREG->SR1[0U] = 0x800U; /* Disable clock monitor range detection circuitry */ systemREG1->CLKTEST &= ~(0x03000000U); /* Enable oscillator */ systemREG1->CSDISCLR = 0x1U; /* Wait until oscillator is enabled */ /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */ while((systemREG1->CSVSTAT & 0x3U) == 0U) { } /* Wait */ /* Clear oscillator fail flag and PLL slip flag if any*/ systemREG1->GBLSTAT = 0x301U; /* Switch back all clock domains */ systemREG1->GHVSRC = ghvsrc_bk; } }
Thanks!