Hello there,
I'm using the TMS570LS202x6 MCU and try to start self test in accordance with example provided in paragraph 6.8.1 of the Technical Reference Manual, step-by-step, but with issues. My code is shown below:
void tagPbist::RunTests()
{
MSTGCR_bit.ROM_DIV = 1; // VBUS = HCLK/2: PBIST will reset for 32 VBUS cycles (4 us)
MSIENA = 0x00000001; // enable PBIST controller (not yet self test)
MSTGCR_bit.MSTGENA = 0xA; // enable PBIST to start self test
// wait 32 VBUS cycles here (or 64 CPU cycles): 4 us for an 8 MHz VBUS
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
asm(" nop"); asm(" nop"); asm(" nop"); asm(" nop");
PBIST_PACT = 0x3; // normal PBIST operation for ROM based testing and enable internal PBIST clock
PBIST_OVER = 0; // run self test without RAM override
PBIST_ALGO = 0x0000000E; // select algorithms 2, 3 and 4 (triple_read_fast_read for ROM and MARCH13N_RED for RAM)
PBIST_RINFOL = 0x000003CF; // select ROM/RAM groups: PBIST ROM, STCROM, DCAN1, DCAN2, MIBSPI, VIM, MIBADC, DMA
PBIST_ROM = 0x00000003; // both algo and RAM info from ROM for application self test
PBIST_DLR = 0x00000014; // config access to ROM-based testing and kick off the self test
while (MSTCGSTAT_bit.MSTDONE != 1) // wait for the self test to complete
continue; // or first occurrence of test failed
if ((PBIST_FSRF0==0x01) || (PBIST_FSRF1==0x01)) // detected error in port 0 or 1 following self tests
{
// read PBIST_RGS and PBIST_RDS to identify the failure
// in the PBIST_RAMT register (see TRM Table 6-1)
// report MCU self test failure to error manager
BitTests.SetMcuFaulty(PBIST_RAMT);
}
PBIST_PACT = 0; // disable internal PBIST clock and internal ROM clock
MSTGCR_bit.MSTGENA = 0x5; // disable PBIST
}
No interrupt is enabled at this time. With the debugger, my issues are identified as:
1) If I set the PBIST_OVER register to 0 (NOT overwrite RAM) as above, the setting of PBIST_RINFOL two lines down the road has no effect, and this register is always 0xFFFFFFFF. At the end of the test, the PBIST flagged MCU error with the DCAN1 device, and execution of the program continues normally (not hang).
2) If I set the PBIST_OVER register to 1 (overwrite RAM) as above, the setting of PBIST_RINFOL two lines down the road is OK, but once PBIST_DLR is written with 0x14 to start self test, the PBIST_RINFOL immediately changes from 0x3CF to 0x1F00. No error is detected at the end but once this function is exited, the Prefetch CPU exception is continually entered and cannot execute any other code.
Can you please help?
Many thanks!
Chuck.