cancel
Showing results for 
Search instead for 
Did you mean: 

how do I clear a bus fault?

andy239955_stm1
Associate II
Posted on September 04, 2008 at 18:39

how do I clear a bus fault?

4 REPLIES 4
andy239955_stm1
Associate II
Posted on May 17, 2011 at 12:24

I am getting bus faults (that escalate into hard faults) from debugger activity (at least the bus fault is usually an access to a debug register). While the debugger vendor is figuring that out I want info on how to clear the error so that other interrupts will get handled.

I have ARM's v7m and cortex manuals and they do not appear to say a single word about resolving these errors, short of hardware reset.

joseph239955
Associate II
Posted on May 17, 2011 at 12:24

Hi Andy,

I am a bit confused about what exactly happened. Normally bus fault caused by debug accesses should be not affect program flow, because the error response should be received by the debugger, not by the processor core, so it should not affect your application code. Unless you are talking about using debug monitor exception code, or the debugger actually load some code in the chip and execute it. Maybe you can tell us more about the debug configuration you are using?

For normal applications, if it have a bus fault exception, usually we can just report the fault and then wait for the system to be reset.

Or if the design is running an OS, the task that generate the fault might get killed by the OS. Once a task has crashed, trying to continue from the same point may result in more errors anyway.

But if you are determined to continue the program execution, if the bus fault is imprecise (see Bus Fault Status Register in document), you can try clear the bus fault status register, and then do an exception return. If the bus fault is precise, you will have to clear the bus fault status register, increment the stacked program counter, and then do an exception return. But if the program has gone wrong, continue the execution doesn't guarantee the rest of the program can continue correctly.

Finally, I think you should try to identify the source of the bus fault exception first. You can try locate the fault by looking at the stacked PC and various fault status register to identify the problem.

andy239955_stm1
Associate II
Posted on May 17, 2011 at 12:24

thanks for replying.

The debugger I was using quit working reliably when the bus fault is pending. Certain of the status registers read wrong which sent me off to find out how certain perfectly valid addresses could cause such faults.

I was able to use the stack trace as you suggest to find the offending code.

A different debugger also showed me correct status on the fault. From the fault address alone I would have been able to figure out where to fix it.

There are two resets associated with the jtag interface and some debuggers need them shorted and some don't.

chenu
Associate II
Posted on May 17, 2011 at 12:24

Andy,

I beleive I have a similar problem (or at least it matches to what you describe in your first post). I am using IAR 5.11.

What was it exactly that caused the fault in your application,

Regards,

Laurent