This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to determine the cause of HardFault

os_evt_wait_or(CHECK_EVENT_FLAGS, INFINITE_TIME);       //Wait for an Event to occur
rx_event = os_evt_get();

switch(rx_event)
{
case EVENT_INTERRUPT:
if(chkflg)
{
        dif = difftime(_gettime(), setalrm);
        if(!dif)
                *(tmp->flg) = 1;             // on execution of this line

        (*tymval)--;

        if(*tymval == 0)
        chkflg = 0;
}
break;

the above code is a part of a task that sets a flag, whose address is passed in a structure using a mail box.
dif is double.
the alarm is generally set to 2 mins (120 secs)
untill the dif > 1, things work well. when the dif = 1, the controller goes into hard fault.

i have read few articles and tried to follow the steps but could not come to any solution.
www.ti.com/.../spma043.pdf

i use LPC17xx

0