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.

cpu crash

Other Parts Discussed in Thread: F28M36P63C2, SYSBIOS

Hi,

I'm experiencing random but relatively rare M3 CPU crashes and i'm out of ideas!

I use a custom board with a F28M36P63C2 processor. TI-RTOS 2.0.1.23.

It's a program that uses several HWI, all configured as instances of HWI using the GUI. All interrupts have the same priority (except the NDK) equal to 224 (priority treshold for disable() = 32).

I'm getting the weirdest things, but the two most often:

- stack overflow in task 0x0.  (while all tasks stacks seem fine in ROV, usually except one which is corrupt)

- hard fault (FORCED)

Sadly it all happens after different interrupt routines.

The thing that starts to appear is that it seems to me that it happens after a semaphore_post() in an HWI. All my interrupt routines post a semaphore to a task that handles the data. I found some posts about it, but they either don't give an answer, or the answer does not apply for me : the priority is above the priority treshold for disable(), and I don't use the 'interrupt' keyword.

The crash happens about every 5 hours, so it's extremely frustrating to find! It is also extremely odd because there are a lot of different interrupts going on at the same time : 2x UART every 1ms a string of 50chars is sent, CAN coms every 1 ms, a lot of ethernet communications, ... It's extremely odd to have a crash only after about 5 hours!

 

an example of an interrupt routine:

void

UART1IntFunction(void)
{
unsigned short Index;
 
// Get the interrupt status.
    ulStatus = UARTIntStatus(UART1_BASE, true);
   
if (ulStatus & UART_INT_TX)
    {
       
while (UARTSpaceAvail(UART1_BASE) && (COM1TxBuffer.ReadIndex != COM1TxBuffer.WriteIndex))
        {
       
// We need to send data
           
UARTCharPut(UART1_BASE,COM1TxBuffer.Message[COM1TxBuffer.ReadIndex]);
           
// Update the pointer
            COM1TxBuffer.
ReadIndex++;
           
if (COM1TxBuffer.ReadIndex >= COM1TxBuffer.BufferSize) COM1TxBuffer.ReadIndex = 0;
        }
    }
   
if ((ulStatus & UART_INT_RX) || (ulStatus & UART_INT_RT))
    {
   
// Loop while there are characters in the receive FIFO.
        
while(UARTCharsAvail(UART1_BASE))
         {
       
// Get writepointer
            Index = COM1RxBuffer.
WriteIndex;
           
// Get writepointer + 1
           
if (Index == (COM1RxBuffer.BufferSize - 1)) Index = 0;
              
else Index +=1;
           
// Check for room in the buffer
           
if (COM1RxBuffer.ReadIndex != Index)
            {
// Read the next character from the UART and place in the buffer
            COM1RxBuffer.
Message[COM1RxBuffer.WriteIndex] = UARTCharGetNonBlocking(UART1_BASE);
               
// Update pointer
            COM1RxBuffer.
WriteIndex = Index;
            }
           
else break;
           
// TODO write error !!  buffer full ==> character lost!
         }
         IPC_Received_UART1 = 1;
         Semaphore_post(IPC_Messages_ToC28);
    }
   
//TODO : other cases, error interrupts
 
// Clear the asserted interrupt.
   
UARTIntClear(UART1_BASE, ulStatus);
}

 

  • Hi Mallekot,

    I'll need more information to help you debug this, such as seeing what you're doing in your task that maybe causing its stack to blow. Also have you tried increasing that tasks stack and see if it doesn't get blown.

    Thanks,

    Moses

  • Hi Moses,

    I found the probable cause : I had a Semaphore_pend in SWI and one in a HWI which i totally overlooked for a few days. I found them by reactivating asserts, and the assert was instantly triggered.

    I changed the method by GateSwi en GateHwi_enter() / Leave().

    All seems to work fine, BUT

    When I pause the processor and look at ROV - Tasks, Hwi, Semaphores,  It all seems kind of mangled:

    e.g.: in Tasks : The first one has the label 'CheckCan0TransmissionHandle' and it should have the function 'CheckCan0Tramission', but instead it gets 'I2C_Task'. Some look OK, but most of them are mangled.

    Also the task "AgvCoreIPCSendUDP" should be a normal task, but appears in task (on the wrong line also) AND in swi. ??

    Semaphores are mangled as well...

    What is happening?

     

  • Moses,

    Another example : the HWI view in ROV:

    It is clear that the 'ti_sysbios_knl_Clock_workFunc__E' has shifted the table of fxn...

     

    Any clue?

  • Can you open the ROV raw view of say the Task module and select Instance states. The 'fxn' field gives you the address of the function for that task. Check that address in your Disassembly view if it matches the right function for that task.

    Moses

  • Hi Moses,

    Thanks for the interest!

    The value of the address points to the correct function as can be seen in the ROV_fxn.jpg .But for some strange reason, the name in the fxn field ine the DETAIL tab is displaying the wrong one.

    So I took the first line : CheckCan0TransmissionHandle, fxn = 0x21abe5 ==> CheckCan0Transmission() ==> OK. But in DETAIL it becomes "UART4IntFunction", wich is also one of the functions connected to a task, but not that one.

     

  • Mallekot,

    There is a chance that the xdc tools that ROV is set to use is different from the one that version of TI-RTOS is using.

    In CCS, select Window-> preferences. On the side bar, select Code Composer Studio->RTSC and you should have this window

    Make sure the XDCtools version selected is the same as the one you're using to build your project. Let me know if that works.

    Moses

  • Hi Moses,

    Thanks a lot! This has solved the label problem!

    Thanks!

     

    Mallekot.