Hello, I'm using the TMS570LS04 with Halcogen and want to create a self test Program that runs multiple Selftests on the device. This is my "main" code.
stcBASE_t stc_data; //stc Data Structure
stcBASE_t *stc_data_ptr = &stc_data; //stc data ptr
unsigned int NumberOfChars, value, counter=0, i=0; //Declare variables
uint8 UARTreceivedData=0;
sciInit(); //Initializes the SCI (UART) module
adcInit(); //Initializes the ADC module
gioInit(); //Initializes the gio ports
hetInit(); //Initializes the het
esmInit(); //Configure ESM module to capture esm errors on Error Pin
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
sciSend(scilinREG, 44, (unsigned char *)"Welcome to the TMS570LS04 Self Test Program.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
sciSend(scilinREG, 67, (unsigned char *)"To continue with the CCM Selftest press 'c' and confirm with ENTER.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
while(UARTreceivedData!='c'){
UARTreceivedData=(unsigned int)sciReceiveByte(scilinREG);
}
sciSend(scilinREG, 22, (unsigned char *)"CCM SelfCheck started.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
CCMKEYR = 0x00000006U; //CPU in Selftest Status
CCMKEYR = 0x00000000U; //reset to Lockstep mode
while ((CCMSR & 0x00000100U) != 0x00000100U){
} //wait for Selftest completition
sciSend(scilinREG, 46, (unsigned char *)"CCM SelfCheck - complete. Test was successful.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
sciSend(scilinREG, 67, (unsigned char *)"To continue with the STC Selftest press 'c' and confirm with ENTER.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
while(UARTreceivedData!='c'){
UARTreceivedData=(unsigned int)sciReceiveByte(scilinREG);
}
if((stcREG->STCGSTAT & 0x00000001U) == 0x00000000U){ //if STC SelfTest not completed (STCGSTAT Bit1 low)
sciSend(scilinREG, 22, (unsigned char *)"STC SelfCheck started.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
stcSelfCheck(); //Start STC SelfTest
}
else if(((stcREG->STCGSTAT) & 0x00000002U) == 0x00000002U){ // STC SelfTest completed and failed (STCGSTAT Bit2 high)
sciSend(scilinREG, 39, (unsigned char *)"STC SelfCheck - complete. Test failed as expected.");
if(((stcREG->STCFSTAT) & 0x00000004U) == 0x00000004U){ //TimeOut Error happened
sciSend(scilinREG, 25, (unsigned char *)"An TimoOut Error occured.");
}
if(((stcREG->STCFSTAT) & 0x00000002U) == 0x00000002U){ //CPU2 Error happened
sciSend(scilinREG, 33, (unsigned char *)" CPU2 error Bit high as intended.");
}
if(((stcREG->STCFSTAT) & 0x00000001U) == 0x00000001U){ //CPU1 Error happened
sciSend(scilinREG, 33, (unsigned char *)" CPU1 error Bit high as intended.");
}
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
}
else if(((stcREG->STCGSTAT) & 0x00000002U) == 0x00000000U){ // STC SelfTest completed and succeeded (STCGSTAT Bit2 low)
sciSend(scilinREG, 46, (unsigned char *)"STC SelfCheck - complete. Test was successful.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
}
sciSend(scilinREG, 23, (unsigned char *)"Starting STC CPU Test.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
while(((stcREG->STCGSTAT) & 0x00000002U) != 0x00000000U){
cpuSelfTest(2, 0xFFFFFFFF, 1); //start STC CPU Selftest
}
if(((stcREG->STCGSTAT) & 0x00000002U) == 0x00000000U){
sciSend(scilinREG, 44, (unsigned char *)"STC CPUTest - complete. Test was successful.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
}
sciSend(scilinREG, 52, (unsigned char *)"Please Press 'c' and confirm with Enter to continue.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
while(UARTreceivedData!='c'){
UARTreceivedData=(unsigned int)sciReceiveByte(scilinREG);
}
sciSend(scilinREG, 26, (unsigned char *)"PBIST SelfCheck started.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
pbistSelfCheck();
sciSend(scilinREG, 42, (unsigned char *)"Memory (RAM) self test (PBIST) - complete.");
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
following problems occur:
The CCM Selftest catches the program in the following loop. The ending condition for the loop: which is the selftest finished bit doesnt get set.
After the first run of the STC Selfcheck the program resets and it needs a second run to complete. I set the Interval number to two, but why cant I just continue the program?
the STC CPU test always resets the entire program, no matter what. I also chose two as no_of_intervals but here I can run the program multiple times and it doesn't help. I'd like to continue after the run.