I'm using TMS570LS3137.
I want to implement fault injection test LBIST STC,and ESM flag is set Group1 Channel 27.
Fault injection implement is use HalCoGen generate function "void SelfCheck(void)" in "sys_selftest.c" ?
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.
I'm using TMS570LS3137.
I want to implement fault injection test LBIST STC,and ESM flag is set Group1 Channel 27.
Fault injection implement is use HalCoGen generate function "void SelfCheck(void)" in "sys_selftest.c" ?
Thank you your answer.
I enable "CCM Self test", and step Into run "stcSelfCheck()" in sys_selftest.c , generate by HALCoGen.
But,Group1 Channel 27 is not set.
Right the following code?
void stcSelfCheck(void)
{
/* USER CODE BEGIN (8) */
/* USER CODE END */
volatile uint32 i = 0U;
/* Run a diagnostic check on the CPU self-test controller */
/* First set up the STC clock divider as STC is only supported up to 90MHz */
/* STC clock is now normal mode CPU clock frequency/2 = 180MHz/2 */
systemREG2->STCCLKDIV = 0x01000000U;
/* Select one test interval, restart self-test next time, 0x00010001 */
stcREG->STCGCR0 = 0x00010001U;
/* Enable comparator self-check and stuck-at-0 fault insertion in CPU, 0x1A */
stcREG->STCSCSCR = 0x1AU;
/* Maximum time-out period */
stcREG->STCTPR = 0xFFFFFFFFU;
/* wait for 16 VBUS clock cycles at least, based on HCLK to VCLK ratio */
/*SAFETYMCUSW 134 S MR:12.2 <APPROVED> "Wait for few clock cycles (Value of i not used)" */
/*SAFETYMCUSW 134 S MR:12.2 <APPROVED> "Wait for few clock cycles (Value of i not used)" */
for (i=0U; i<(16U + (16U * 1U)); i++){ /* Wait */ }
/* Enable self-test */
stcREG->STCGCR1 = 0xAU;
/* USER CODE BEGIN (9) */
/* USER CODE END */
/* Idle the CPU so that the self-test can start */
_gotoCPUIdle_();
/* USER CODE BEGIN (10) */
/* USER CODE END */
}
Without error and into " _gotoCPUIdle_();"
Error not occur is right behavior ?
Do you know how to error occur ?
I think you don't understand the mechanism here Arriy.
This line doesn't begin the CPU self test:
/* Enable self-test */
stcREG->STCGCR1 = 0xAU;
It enables it, but the self test doesn't begin until the CPU executes a WFI instruction
(enters the idle state). Which is what happens inside: _gotoCPUIdle_();
And the exit from self test is through a CPU reset, so this function call doesn't return.
Now, this particular code you are looking at is tricky to execute even with the debugger.
That is because WFI is a 'hint' instruction it is not guaranteed to put the CPU into IDLE.
That means the STC may or may not start the first time that the WFI is executed.
There are many conditions including debug requests and any interrupt requests to the CPU (EVEN if the I AND F bits of CPSR have the interrupts disabled!) that keep the CPU from entering IDLE and prevent the self test from beginning.
And when you do get the self test to execute - you come out at the reset vector again.
*and* when you run the self test - the breakpoint you might have set at the reset vector is cleared because that breakpoint lives inside the CPU logic that is tested. [the CPU state isn't restored automatically so the breakpoint is gone after the STC runs.].
So if you want to observe this through the debugger you really need to write some code that checks for a CPU reset and puts you into some delay loop where you actually have enough time to halt the device execution... You can't even set a HW breakpoint at address 0 to trap the reset.
Hi Anthony.
Thank you your answer.
I got what I wanted to do, after executed "SL_SelfTest_STC" of SafeTI Diagnostic Library.
You said "LBIST selftest finished is through a CPU reset".
But after selftest , System Exception Status Register(SYSESR) flag is not set.
Do you know why ?