Content originally posted in LPCWare by wellsk on Thu Jul 11 12:52:00 MST 2013Descriptors should be re-queued for transmit on underflow - this sounds like an oversight and should get a <a href="http://www.lpcware.com/node/add/ct-plus-task">bug tracker issue </a>created for it. However, you'll need to determine the reason for the underflow as re-queueing won't help if that issue exists.
>dn = 2 (number of descriptors needed)
Are you using the HTTP server example? I've seen cases where the pbuf chain contains a buffer that is a ROM buffer in SPIFLASH or slower memory. The Ethernet DMA will attempt to queue a buffer from any memory locaiton in a descriptor, but if the memory is too slow, the ethernet will underflow.
A mechanism was added to copy buffers located in slower memory to a faster pbuf prior to sending using the LPC_CHECK_SLOWMEM and LPC_SLOWMEM_ARRAY definitions. If you set LPC_CHECK_SLOWMEM to 1 and setup an array on memory addresses/ranges with slower memory using LPC_SLOWMEM_ARRA, the driver will automatically handle pbuf copying for buffers if it's needed.
Here's an example setup for external SPIFI FLASH..
<pre>#define LPC_CHECK_SLOWMEM 1</pre><pre>#define SPIFI_BASE_ADDR 0x14000000#define XFLASH_BASE_ADDR 0x1C000000</pre><pre>#define LPC_SLOW_MEM_SIZE ((4 * 1024 * 1024) - 1)/* Array of slow memory address ranges for LPC_CHECK_SLOWMEM */#define LPC_SLOWMEM_ARRAY {{SPIFI_BASE_ADDR, (SPIFI_BASE_ADDR + ((4 * 1024 * 1024) - 1))}}</pre>>I am reluctant to increase LPC_NUM_BUFF_TXDESCS because (a) i don't have any more SRAM available and (b) it would only make this bug happen less often. At this point of development I want to make it happen more often so I can fix it properly.
It looks like you have 7 now, that's more than enough. You have 7 'in use', but likely not reclaimed correctly due to underflow.
>I tried enabling EMAC_DEBUG but the amount of trace that comes out is such that it slows the whole process down enough to criple the processor, so it's not representative of the normal operating conditions.
True, but the output is useful for debugging this specific issue. It gives an idea of where the buffers are being sent from. I wouldn't keep this one once LWIP is operating correctly. I can help debug this to an extent, but would need to see the messages the LWIP EMAC driver produces at run-time. Maybe you can post your project files?