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.

Have I broken it?



Hi all you experts...

I have written a self test for the CPU. ( LBIST), and I think that my micro is stuck in a loop, with the self test running, but the CPU reset bit in SYSERR never getting set.

I can now not connect with the debugger - cos the device is busy self testing. Any ideas as to how I can get it back?

thanks.

  • Hello Phil,

    The only solution at this point is to attempt to catch the CPU in a state prior to or between LBIST interval executions and erase the code from the device. The best way to do this is to try and hold the device in reset when connecting with NowFlash. To do this setup NowFlash to erase the device and hit execute while holding the device in reset. Release the reset when the com window message is initializing or connecting. It will probably take several iterations of this in order to catch the code on the device at a state where the CPU can be interrupted.

  • Phil,

    There is no good solution for your problem. CPU is stuck in a reset->LBIST->reset->LBiST->reset->.. loop. You can try releasing reset and at the same time connecting to CCS. It is going to be very hard to hit the correct timing.

    To check the operation of LBIST, you need to check the SYSERR register in the beginning of your test code. You can put CPU in a while(1) loop for you to check if there are any error. You can also run this test from RAM. If you really want to run this test from Flash, you can use an I/O pin to control the test. For example, only run LBiST when the I/O pin is high.

    Please let me know if this would solve your problem.

    Thanks and regards,

    Zhaohong

  • This is the code that I am running.....

    hal_io_set_trace_pins(0);

    if ( ( SYSTEMREG->SYSESR & 0x00000020u ) == 0x00000020u )
    {
    hal_io_set_trace_pins(3);
    /*
    we are here because the last reset was caused by the CPU reset following
    selftest. Clear the flag so that on subsequent resets we
    will run the test. Normally only once per power cycle.
    */
    SYSTEMREG->SYSESR = 0x00000020u;
    lbist_result = (uint8_t)LBIST->STCGSTAT;
    if ( lbist_result != 0x01u )
    {
    /* we failed, so go to a safe state. */
    selftest_halt();
    }
    }
    else
    {
    hal_io_set_trace_pins(1);
    /*
    we need to run the memory test, and start the CPU test.
    */
    /*
    to run the memory test, select the algorithm, run the test, check results.
    If the result is a pass, then continue on with the LBIST.
    */
    selftest_init_mbist( MBIST_SYSTEM_RAM | MBIST_SPI1_RAM | MBIST_CAN1_RAM | MBIST_STC_RAM );
    /* Enable the MBIST */
    SYSTEMREG->MSTGCR = (SYSTEMREG->MSTGCR & 0xFFFFFF00u) | 0xAu;

    /* wait until till MBIST completes */
    while((SYSTEMREG->MSTCGSTAT & 0x1u ) != 0x1u )
    {
    }
    hal_io_set_safety_error(ACTIVE);
    /* check if there are any failures */
    mbist_result = SYSTEMREG->MSTFAIL;

    /* Disable the MBIST */
    SYSTEMREG->MSTGCR = (SYSTEMREG->MSTGCR & 0xFFFFFF00u ) | 0x5u;

    /* Check whether the global MSTdone gets cleared */
    while ((SYSTEMREG->MSTCGSTAT & 0x1u )!= 0x0u )
    {
    }

    if(mbist_result == 0x00u )
    {
    /* MBIST is complete, so we can now run CPU test */
    hal_io_set_trace_pins(2);
    selftest_cpu_lbist();

    }
    else
    {
    /* we failed, so go to a safe state. */
    selftest_halt();
    }

    }

    It should not run the LBIST if the CPU reset is detected....... 

    I'll try the reset / erase technique..... then get the soldering kit out.

    Thanks,

    Phil

  • Phil,

    The problem is that you rum MBIST first. After running MBIST, all the RAM content is lost. You cannot continue execution if the execution is dependent on any RAM content which is set before MBIST. I saw that you use a pointer to access MBIST status. This pointer has to be a "register". If you do not define it as a register, it is defined in RAM. Its value will be lost after MBIST.

    Thanks and regards,

    Zhaohong

  • Hello Phil,

    Since there hasn't been any activity in quite some time on this thread, I will assume that the answer above was sufficient to help you fix your problem. As such, this thread will moved to the closed state. If you still hav ethe same issue or if you have any new questions, please open a new thread.