This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Should I use lwip instead of uip, because uip has some issues...

Other Parts Discussed in Thread: EK-TM4C1294XL

Hi,


I am using a Tiva C Series Connected Launchpad EK-TM4C1294XL for my project. I managed to completly rewrite the uip_example application in TivaWareLibrary/boards/ek-tm4c1294xl/enet_uip to send and retrieve data over port 8080 and controlling an AD5754 D/A converter. But when sending a lot of data UIP refuses to work correctly.

First I send 4-bytes-packes in an interval of 10 ms from an application on my laptop over the network to the device. It looks like this.

Client side:

Connecting to server...
Connection established!
Receiving...
V0.1
396 B/s (sent=396 B, received=0 B)
792 B/s (sent=1.160 kB, received=0 B)
1.160 kB/s (sent=2.320 kB, received=0 B)
1.547 kB/s (sent=3.867 kB, received=0 B)
1.934 kB/s (sent=5.801 kB, received=0 B)
2.320 kB/s (sent=8.121 kB, received=0 B)
2.707 kB/s (sent=10.828 kB, received=0 B)
Statistics:
1584/s (sent=11088, received=0)
Programm finished.


Unfortunately the data rates a wrong.

Server side:

Initialize AD5754...
Initialize Ethernet...
Registering interrupts...
Using Internal PHY.
Waiting for MAC to be ready...
MAC ready.
Waiting for Link.
Link Established.
Waiting for IP address...
Starting network listener...
IP: 192.168.178.20
CONNECTED
POLL (received=149, sent=0)
ACKED
POLL (received=353, sent=5)
POLL (received=553, sent=5)
POLL (received=757, sent=5)
POLL (received=957, sent=5)
POLL (received=1161, sent=5)
POLL (received=1361, sent=5)
POLL (received=1561, sent=5)
POLL (received=1765, sent=5)
POLL (received=1965, sent=5)
POLL (received=2169, sent=5)
POLL (received=2369, sent=5)
POLL (received=2573, sent=5)
POLL (received=2773, sent=5)
POLL (received=2789, sent=5)
CLOSED (received=2789, sent=5)
CLOSED (received=2789, sent=5)

You can cleary see that there were 11088 bytes sent from the client but only 2789 received on the server. Also the server gives me two times the message that the connection was closed. Why?

The next problem happens when I remove the 10 ms delay on the client side for more speed. After a while the server stops receiving data for a while and then receives some chunks of data in undefined intervals of 30 seconds to 1 minute or sometimes more. After it has received some chunks of data it refuses to work completely and on client side the application is not able to send more data. I guess because the sending buffer is full. Here an example:

Client side:

Connecting to server...
Connection established!
Receiving...
V0.1
371.891 kB/s (sent=371.891 kB, received=0 B)
825.578 kB/s (sent=1.169 MB, received=0 B)
1.254 MB/s (sent=2.424 MB, received=0 B)
1.703 MB/s (sent=4.127 MB, received=0 B)
1.977 MB/s (sent=6.104 MB, received=0 B)
2.220 MB/s (sent=8.324 MB, received=0 B)
2.472 MB/s (sent=10.797 MB, received=0 B)
2.926 MB/s (sent=13.723 MB, received=0 B)
3.394 MB/s (sent=17.117 MB, received=0 B)
3.854 MB/s (sent=20.971 MB, received=0 B)
4.309 MB/s (sent=25.280 MB, received=0 B)
[TERMINATED]

Here the data rates are also wrong. Sorry for this.

Server side:

CONNECTED
POLL (received=149689, sent=0)
ACKED
POLL (received=289602, sent=5)
ERR
ERR
ERR
ERR
POLL (received=523048, sent=5)
POLL (received=763451, sent=5)
POLL (received=996124, sent=5)
POLL (received=1243484, sent=5)
POLL (received=1486979, sent=5)
POLL (received=1727382, sent=5)
POLL (received=1913675, sent=5)
POLL (received=2051269, sent=5)
ERR
ERR
ERR
ERR
POLL (received=2147894, sent=5)
POLL (received=2296310, sent=5)
POLL (received=2402211, sent=5)
POLL (received=2552173, sent=5)
POLL (received=2798760, sent=5)
POLL (received=3046893, sent=5)
POLL (received=3294253, sent=5)
POLL (received=3541613, sent=5)
ERR
ERR
ERR
ERR
POLL (received=3790519, sent=5)
POLL (received=4033241, sent=5)
POLL (received=4279055, sent=5)
POLL (received=4521004, sent=5)
POLL (received=4523323, sent=5)
POLL (received=4524869, sent=5)
POLL (received=4526415, sent=5) × 4
POLL (received=4529507, sent=5) × 13
POLL (received=4531053, sent=5) × 25
POLL (received=4531826, sent=5)
POLL (received=4532599, sent=5)
POLL (received=4532599, sent=5) × 2
...

I shortened the output of the server and replaced multiple occurrences of the same line with " × <occurrences>". You can also see here some lines which say "ERR". That is the forth problem I have. It seems that the server sometimes receives wrong characters but normally it should not be possible to send wrong packages over TCP/IP. If a package was wrong the client should send them again.

In summary there are 4 issues:

  1. I get two times the CLOSED message (uip_closed()).
  2. I do not receive all data which have been sent from the client.
  3. When there were sent a lot of data uip refuses to received after a while.
  4. Sometimes there were received wrong characters.

  • There is also a fifth problem:
    When I have to kill the client program because the server does no more receive any data the server does not recognize that the connection can be closed. How could I manage that? Maybe with a heartbeat like mechanism?
  • Hi Nicolas,

    I am not an expert in uip and lwip. But, I have read some articles in the internet that uip has limitations. In that case to get over the limitations, it is recommended to use lwip instead.

    - kel
  • Nicolas, sorry ask forever repeatedly same question: have you provided all information to analyse what happen at your side?
    What is the output you provided from your custom software? How are connection made? Is server/client able to manage this data volume? (10mS 4 byte yes forever can be also in a (moderately but not completely) congested network).
    Otherwise silence or vague answer(if not completely useless) reach you.

  • Any a suggestion?

    I had briefly tested an application using lwip about a year ago, on a similiar MCU (Cortex M4, but other vendor). It was a basic http server example, with "sparse" traffic. That leads me to believe lwip is not that bad.

    I suggest to have a close look at the lowest level routines, which deal with interrupts and DMA from the ETH peripheral. Your problem description sounds like you have a problem with interrupt load, interrupt priorities, and/or CPU load in general. A 10 MBit link can give you roughly 1 MByte/sec, which is really a hard job for the MCU to keep up with over extended periods. My guess - the core is just overrun with high ETH load. That causes dropped packages, and probably helps to manifest "hidden" bugs in the low-level driver firmware.

    So my suggestion - instrument and debug this driver routines.