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.

Checking STC module always resets with TEST_FAIL bit

Other Parts Discussed in Thread: HALCOGEN

Hello,

Every time I execute the stcCheck during boot, the test causes a reset (it is supposed to do that, so that's ok), but when I check the TEST_FAIL bit, the bit is always set, meaning that the stcCheck failed.

When I check the STCFSTAT to see what happened, it indicates a CPU 1 fail and CPU2 fail, which is caused by comparing the MISR registers with the golden MISR stored in ROM.

Any ideas about waht could be doing this?

  • Hello Pablo,

    Can you provide details of your code generation. In other words, is the stcCheck function you mention code that you have written or is this code generated by Halcogen? If generated by Halcogen, can you provide details of which version of Halcogen you are using? I looked for the function stcCheck in the latest version of Halcogen (v3.06) and was not able to find this code.

  • This is part of my reset handler:

    ...
    else if (SYSReg1->SYSESR & 0x20U) {
            /*Here it checks if it was a CPU reset. CPU resets occur after CPU self-test (stc module)*/
            if (!(STCReg->STCGSTAT & 0x1U)) {
                /* This means that the test was not completed, so it should be restarted. Although it should not have to
                *  restart the test if it has already failed twice.
                */
                stcSelfCheck();
            } else {
                /*After the test was completed it should be tested if the test failed or not*/
                if (STCReg->STCGSTAT & 0x2U) {
                    while(1);	/*If the test was completed, but it was not successful (TEST_FAIL bit = 1), then boot process must not go on.*/
                } else {
                	afterSTC();
                }
                    /*If the was successful then it can go on to the system's boot*/
                
            }

    My stcCheck is this:

    void stcCheck(void) {
        unsigned int i;
    
        SYSReg2->STCCLKDIV = (0x1U << 24);
    
        STCReg->STCGCR0 = (1U << 16U)
                            | 1U;
    
        STCReg->STCSCSCR = 0x1AU;   
        STCReg->STCTPR = 0xFFFFFFFFU;
    
        STCReg->STCGCR1 = 0xAU;
    
        _asm_CpuIdle();
     }

    Up to this point everything works, but when after I run stcCheck it reaches the point where the TEST_FAIL bit is set, indicating a failure during stc self check.

    **EDIT:**

    I'm not using HALcogen

  • Remove the line:

      STCReg->STCSCSCR = 0x1AU;  

    This is error forcing test to "check the checker" to make sure the signature compare and error reporting circuirty is working correctly.  You should run the error forcing test first, verify you get the failure,

    Clear the error by "Disable one or both of the SELF_CHECK_KEY and FAULT_INS bits in the STCSCSCR register. Then restart the self test by programming bit 0 of the STCGCR0 register to 1. On the completion of the test the TEST_FAIL bit will be cleared in the STCGSTAT register. 

     Then run your your real STC test.

  • Hello Pablo,

    The stcSelfCheck is a mechanism to check the stc failure notification logic as was mentioned in another post on this thread. In this case the errors are expected and means that the selftest worked as intended.

    If you utilize Halcogen to generate some startup code, it will generate some code you could use as reference. In it would be included the selftest to check the error notification path and that the STC logic is working as intended and additional code to actually run a real STC LBIST test.

    This can be done by starting a project within the Halcogen tool for the device you are using and navigating to the SAFETY INIT tab. Select the self tests you wish to include in your code and it will be generated for the project. Specifically for STC, select the Enable STC Self test.

  • Hello Pablo,

    If the prior posts/replies were able to answer your questions, please verify the answers so we may close the thread. If there are additional questions or a need for clarification, please let us know.