2013-01-02 12:55 PM
Any help with finding this bug is appreciated. I am truly at a loss.
I am using the virtual com port for USB(V.3.1). I had it working great, communication was like a wife and husband once wished. I was sending host data through pre-assembled arrays and sending characters 1 by 1 by USART_To_USB_Send_Data function. Now I do the same the but use _io_putchar() along with printf(), so I have added #include <stdio> and a few functions.Of course, I simple change suddenly caused a hard fault error? I have never dealt with these before and am not sure what to do with it. In comparing code, I cannot find any problems, looking through the reference and programming manual has not helped. After the fault occurs, the debug explore shows the following info:HFSR = 0x04000000VECTTBL = NO FAULTFORCED = SETDEBUGEVT = NO Fault Related to DebugThanks much.2013-01-02 01:42 PM
You need to look at the faulting instructions. How printf() works will depend on your tool chain, you don't mention which. If you haven't got Keil set up properly wrt to semi-hosting you'll get an SWI instruction faulting the processor.
A decent fault handler should point you in the right direction. This one might be a bit of a catch-22 as you don't have a functional printf(), you want to be locating the PC of the faulting code, you can dig through the stack.