2009-11-26 07:46 AM
Investigating HardFaultException
2011-05-17 03:29 AM
I am getting HardFaultExceptions somewhere in my code for my printf to USART1. This uses DMA to transfer the string to the UART.
My question is how can I find out where this hard fault is occurring. It is a race condition occurring between something and is very frustrating as when I use JTAG to debug the race condition doesn't occur. Is there a way to find out the reason for the HardFaultException (is there a status register?) Can I view things like the PC before the hardfault, as the context saving is done by the Cortex hardware. I have tried reading the datasheet and reference manual for any mention of faults and I haven't found anything. Any tips would be great. Regards Paul2011-05-17 03:29 AM
Thank you for the link Paul.
This was the exact document that I have been looking for. It explains the whole exception and NVIC paths, exactly what I need. (and more) Now just to find this pesky bug....2011-05-17 03:29 AM
Yes - the hard fault status register, but you will probably have to check a few other registers until you get to the cause of your problem, which may take a while.
They are all detailed in the ARM Cortex M3 Technical Reference Manual: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337e/DDI0337E_cortex_m3_r1p1_trm.pdf I had a hard fault problem (see forum) and found that it was a read of a bad memory address, and eventually found a register containing the address of the offending code.2011-05-17 03:29 AM
Paul,
I am having a similar problem with my code, which incurs a HardFault during a printf to USART1. Did you ever find the source of the hardfault or were you able to mitigate it somehow? Apologies for reviving this year-old-thread. Here are the details of my issue. Thanks!