Hello,
I'm trying to send UDP-packets from an LM3S9B96 to the PC. But every time when I call the Library-function "udp_get_buf(len);" I get an Hardfault-IRQ. Receiving the UDP-Packets from the PC is no problem, so my initialization from the UDP should be ok. Any ideas what could be wrong?
Thank you.
Regards, Mike
You have enough stack size?
Yes I have enough stack. But for testing I increased it immensely but with the same result...
Enough heap? I think the minimum is 0x400 bytes, but I'm not sure.
Yes, also enough heap! I increased both heap and stack to 0x5000 bytes. With no effect!
Looks like time for some single stepping.
Burp.
Now I found another hint. I use this function in combination with the Keil-RTOS. The allocation works if I call the function udp_get_buf() before the RTOS-initialization: //---RTOS-Setup os_sys_init_prio(InitTask,250);
But what is the reason that it doesn't work after starting all tasks?
Have you allocated enough stack space PER TASK (RTX_Config.c) or for user mode (startup file probably) ?
The stack-size for every task is set to 1600 bytes in the file RTX_Config_CM.c. But still the same problem. Thank you for your help! Mike
Any other ideas?
As I said before:
If you are using the StellarisWare's lwIP Wrapper Module, then maybe, it is good to check the
The lwIPInit() function is used to initialize the lwIP TCP/IP stack. The lwIPEthernetIntHandler() is the interrupt handler function for use with the lwIP TCP/IP stack. This handler will process transmit and receive packets. If no RTOS is being used, the interrupt handler will also service the lwIP timers. The lwIPTimer() function is to be called periodically to support the TCP, ARP, DHCP and other timers used by the lwIP TCP/IP stack. If no RTOS is being used, this timer function will simply trigger an Ethernet interrupt to allow the interrupt handler to service the timers.
Google told me that you are using RL-ARM, then maybe, it is good to check the below URL.
www.keil.com/.../rlarm_tn_using_withkernel.htm
The last URL was a good hint. Apparently the usage of the RTOS is the problem. The UDP handling works if I don't use the RTOS. But sending UDP-data is not possible if I use the RTOS. I always get a hard fault! But receiving works...
"But sending UDP-data is not possible if I use the RTOS."
Are you sending an unsolicited transmission or as a result of receiving something?
I do the latter with RL-ARM and have no problems.
I want to send the packet after receiving data. But I also noticed that without RTOS all the ARP-stuff is done (I watch the ethernet traffic with Wireshark). But with the RTOS not although I call main_TcpNet(); and timer_tick (); regularly.