|
From: | Julio Cesar Aguilar Zerpa |
Subject: | [lwip-users] Device crashes while connected via TCP and Serial simultaneously |
Date: | Thu, 26 Jan 2017 11:42:50 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
Hi there guys, I don't know how to approach this problem. Hopefully, you can give me some tips. I am working with lwip 1.4.1 and the Texas Instrument HDK RM57 without an OS.Sorry for the long email. I need you to get a good overview of my problem :-) How my program works:
Problem:
Things I noticed:
Tests I did:
The problem only occurs when both the TCP and the asynchronous
serial communication are active at the same time. (Maybe related) The TCP client on the PC is actually a GUI
that displays my sensor data. When connected, the "image" of the
sensor data "jumps" once every ~2 seconds. The data is wrong. I
thought this could be a copy error from the serial buffer to the
tcp buffer. But, before the board sends the data over TCP, it
processes it and checks if the data is wrong or corrupted. If it
is, it sends several error signals (LEDs and serial debug data).
When the image in the GUI jumps, I also get the error signals from
the board (which means, the data is actually wrong). When the
server is not connected to the GUI, I do NOT get those
error signals from the board. This looks as if the TCP server somehow affects the interrupt
routine of the serial interface (or the same memory area?) (and
somehow corrupts its buffers?). So, I saw in my port (which I got
from a Texas Instrument tutorial on LwIP and the board I am using)
that the functions below are called the whole time because of
SYS_LIGHTWEIGHT_PROT = 1. I thought that maybe the serial
interface doesn't like it when its interrupt is being enabled and
disabled that fast.
I then changed that define to SYS_LIGHTWEIGHT_PROT = 0. This
functions were not called again, but the program still crashes. (Maybe related) I have another connection to another part of the GUI. Both connections work at the same time. The board crashes faster than with one TCP connection. (Unrelated) I checked both connections with Wireshark. I noticed that the protocol of connection A (52 bytes data size) is TCP and the description shows "PSH", "ACK" and similar things. However, the protocol of connection B (sensor data: 1056 bytes) says ECHO and the description just shows "response". I use two servers with the same structure. Why would one have another protocol type? What does that ECHO mean? By the way, I've had the lwip stats active when the crash occured
but it doesn't show any error. I don't have much experience in embedded programming. I don't know how to investigate this deeper. What else can I check? Maybe my port is not right? Has someone a port to the HDK RM57 that I can compare? I really appreciate any help. Best regards, Julio |
[Prev in Thread] | Current Thread | [Next in Thread] |