mbed IP library over Ethernet

Dependencies:   lwip-eth Socket lwip lwip-sys

Dependents:   denki-yohou_b Network-RTOS NTPClient_HelloWorld temp_FIAP ... more

Issue: Out of Memory issue related to DMA Bounce Buffer

I am using 3 LPC1768 cards and am sending data from a 'host' card over a UDP socket to the other 2 'device' cards. The program I am running on the host card works fine for a period of time and then every once in a while it starts getting -1 returned from the socket.sendTo() method. This continues as long as there are regular calls to sendTo. After a brief pause, further calls to sendTo complete normally. I tracked down the error to a call to pbuf_alloc() in lpc17_emac.c, on line 642.

Oddly, the error seems to be triggered when the host card switches from sending to a different device card. I have 2 UDP sockets open and unique Endpoint instances for each socket, one for each device card. When the host quickly sends some data to one device then the other, and then back to the first one the error manifests. This is repeatable every time after 50 such bursts.

I don't fully understand the details of the mbed driver, but if I comment out the transmit bounce buffer in lpc_emac_config.h (LPC_TX_PBUF_BOUNCE_EN 1) then everything seems to work fine. I never get an error code returned from socket.sendTo(). However, I am a bit worried about the effect of disabling the bounce buffer, since the driver seems to think the packet data I am attempting to send is not in a memory region that is safe for DMA.