|
From: | mary_west |
Subject: | [lwip-users] LwIP tcp_output Pcb Corruption |
Date: | Thu, 21 Mar 2013 13:17:59 -0600 |
Hi - I'm having an lwip problem in tcp_output. It hangs in the following ‘for’ loop. /* useg should point to last segment on unacked queue */ useg = pcb->unacked; if (useg != NULL) { for (; useg->next != NULL; useg = useg->next); <------- here } Here's the background: - processor: STM32F107vc - lwip 1.4.0 - NO_SYS = 1 - using raw API - ethernet set up on an interrupt using DMA - ethernet driver is pulled from an STM32F107 Lwip application note and example code The stm32 board sits between a device and a PC. It receives CAN messages from the device and sends them to the PC as tcp messages. When the problem occurs, the pcb is corrupted. All ->nexts point to the same address. I've read in the archive that this is due to the main and interrupts using the lwip stack at the same time. The main loop runs the tcp timers. The interrupt calls ethernetif_input. On the send side (where it fails), the main checks a CAN queue and if there are messages, builds a tcpip msg and calls tcp_write followed by tcp_output. The tcpip traffic going to the PC consists of MANY small packets. I have disabled the Nagle algorithm. I read this in the archive as part of an answer to a question about a similar input problem: "When running without an OS, you have to put new packets on a linked list that is processed periodically from main() (just like the timers)." Is this true for outgoing tcp packets? What are the safeguards for protecting the pcb from corruption? Any help would be appreciated. Thanks- Mary |
[Prev in Thread] | Current Thread | [Next in Thread] |