Hi Marty,
I'm not using any OS, it's bare metal (you could say cooperative multitasking through non-blocking sub-system state machines). The network is serviced at more than 3kHz. I print out the min and max main cycle times (every 5s for each of the last 5 x 1s), and the max is usually around 1ms (the highest I've seen was 53ms), so I don't think that is the issue.
I did enable some more lwip debugging output and saw that at some point pbuf fails to allocate memory on receiving a packet. This does not make sense to me as the packets are small and infrequent (every 20s), and I do see pbuf free messages in the debugging output. I expect that the number of buffers should be quite sufficient for the small and infrequent frames as they should get reused. This is a memory setup that I tested yesterday (and that also failed):
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
sends a lot of data out of ROM (or other static memory), this
should be set high. */
#define MEMP_NUM_PBUF 40
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
per active UDP "connection". */
#define MEMP_NUM_UDP_PCB 4
/* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP
connections. */
#define MEMP_NUM_TCP_PCB 4
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
connections. */
#define MEMP_NUM_TCP_PCB_LISTEN 4
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
segments. */
#define MEMP_NUM_TCP_SEG 20
/* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
timeouts. */
#define MEMP_NUM_SYS_TIMEOUT 5
/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
#define PBUF_POOL_SIZE 16
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE 1536
Regards,