XMC4500 ETH-Problems with httpserver_raw-example

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Not applicable
Hi,
i have several problems using the httpserver_raw example from the xmclib.

The server is working and can be pinged, but its response was quiet slow, therefore i enabled debugging and recognized, that there is a lot of pbuf allocation and freeing:

pbuf_free: deallocating 0x20006d68
pbuf_alloc(length=0)
pbuf_alloc: allocated pbuf 0x20006d68
pbuf_alloc(length=0) == 0x20006d68
pbuf_free(0x20006d68)
pbuf_free: deallocating 0x20006d68
pbuf_alloc(length=0)
pbuf_alloc: allocated pbuf 0x20006d68
pbuf_alloc(length=0) == 0x20006d68

This holds true, even if the ethernet cable is removed.

Another issue, is that dhcp is working only sporadically. In the most cases after a reset, no DHCP-packet is send out(debugged with wireshark).
Just set the define flag in the main.c to see this bevaviour.

Find attached the whole project.

Best regards,
Stefan
0 Likes
6 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

Do you think it would be helpful if you try the lwIP forum? As I have limited knowledge on the stack which I am also trying to build my knowledge n experience while working on this. So sorry about this. 😞
0 Likes
Not applicable
Hi travis,
In my opinion the problem is not within the lwip stack, but in the mac driver or the phy-driver, respectively.

i have used lwip at a few other controllers(st,ti) and a simple udptransmission was never a problem, therefore, lwip should run.

it is really a pity, that infineon is not capable of providing a functional ethernet driver for XMC4500 even after years of driver (and time-wasting app) development.

best regards, red
0 Likes
Not applicable
Hey red,

I've got similar issues working with the XMC4800 http-example. To me it looks like a memory corruption in the pbuf-pool, but I didn't manage to find it by now. Changing to malloc (MEMP_MEM_MALLOC = 1) and polling the ethernet-interface without interrupts fixed things for me, but I still wonder why pbufs don't work.

Generally it seems to me like the software-devs at Infineon have some issues understanding concurrency. I just started working with their hardware - and lwip - so I might have got something wrong, but this is what I found by now in my example code:


  • ethernetif.c: ETH0_0_IRQHandler: XMC_ETH_MAC_ClearEventStatus is called after reading the packets -> A packet-reception event might be lost. But who cares: There is always some traffic on the network, that will wake up the system eventually
  • ethernetif.c: ethernetif_input: pbufs are allocated and freed in and outside the interrupt context, but neither sys_arch_protect, nor sys_arch_unprotect are implemented.
  • ethernetif.c: low_level_input: pbufs (of size 0) are allocated, even if there is no packet to be picked up
  • ethernetif.c: low_level_input/low_level_output: Both functions use the same buffer, although one is called from the interrupt context and the other isn't.


Having worked with Atmel and Microchip I'm a bit shocked be the quality of the examples. I found similar issues in their other examples.

Edit: Just found another issue.
0 Likes
Not applicable
Just found yet another issue handling pbufs in ethernetif.c: low_level_input/low_level_output (reading the documentation is overrated), but unfortunately it did not solve my issues. -> Back to malloc.
0 Likes
Not applicable
why there are no reply to these posts?
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Please update your projects using the latest XMCLib or using the latest version of the ETH_LWIP/HTTP_SERVER APPs.
Several fixed have been done since then.

Regards,
Jesus
0 Likes