Hi, it is as is, my lm3s9d92 keep getting bus fault while executing echo server routine. After it registers an accepting callback function, it goes to 'waiting' state.
I used TCP test tool to connect to the board, which in turn causes receive interrupt in my server routine.
(I've tried to write the initialization process almost same as the example 'enet_lwip' from stellarisware. I've put out locator functions and used static IP address. Yes, I am aware of endianness in case of writing ip address, and my pc is in the same subnet with the board)
Whenever I click 'connect' button in waiting state, it immediately goes to FAULT ISR, and I don't know the reason why.
I've tried to track this. through a long series of debugging process, I found that all the fault is coming from the same line of the code, which is the one highlighted below
static err_tstellarisif_transmit(struct netif *netif, struct pbuf *p){int iBuf;unsigned char *pucBuf;unsigned long *pulBuf;struct pbuf *q;int iGather;unsigned long ulGather;unsigned char *pucGather;
/*** Fill in the first two bytes of the payload data (configured as padding* with ETH_PAD_SIZE = 2) with the total length of the payload data* (minus the Ethernet MAC layer header).**/*((unsigned short *)(p->payload)) = p->tot_len - 16;
the fault is caused right after that line by using step by step approach, and as I looked into nvic registers, I could see that the precise data bus fault bit was high. but I have no clue what this precise data bus fault is and what could be the cause of this fault so I'm in a loss. If there's anyone who could give me some good guidelines about this matter, I would be most grateful.
thx for reading this.
Hello Heesoo Ahn,
I believe you will find the "Diagnosing Software Faults in Stellaris Microcontrollers" application note (http://www.ti.com/lit/an/spma043/spma043.pdf) quite helpful. It is a good starting point and perhaps will allow you to find the cause. If you are still stuck, please let us know what you do find using that information and perhaps we can help further.
thx, that helped a lot in clarifying the issue. But again, I ran into another problem.
When i run the program with breakpoints in stellarisif.c the board gets bus faults with precise point of address. the address i got from the debugger was 0x00FF0468, which was clearly out of bounds of flash or any other mapped memory areas.
Then I tried running the program without breakpoints(besides the one on the fault isr), however ends in fault isr when I try to connect with TCP test tool, and came out with interesting result. this time the case was invalid state fault and as I tried to track down latest address where PC was pointing, I ended up finding it in SRAM heap area(0x20001980). this got more puzzling than what it was like in the first place!
If it was related with not enabled peripheral, this would be rather easy. But this... brings me to my wit's end.
Try increasing the stack size for your project.
been there, and done it. ended with no good results, I think the problem resides elsewhere.
I edited startup_ccs.c file to modify stack size up to 1024, 2048, 4096(bytes, I suppose). The default setting was 256 bytes, and enet_lwip example used 1024 bytes. However, it changed nothing.