cancel
Showing results for 
Search instead for 
Did you mean: 

LWIP + ETH: Degrading performance

Francisco Exp�sito
Associate II
Posted on April 13, 2016 at 12:51

Hi everyone,

I�ve implemented a websocket client that runs on a STM32F4 with FreeRTOS and lwIP 1.4.1.

The client is supposed to send the machine status to the server each 5 seconds (plain text message).

I let the client run for 2.5 days and the result is the following:

  • After 2 hours running smoothly, the client starts experiencing delays. For example: it doesn�t send anything during 15 seconds and all of a sudden it sends 3 status messages in a 1 second period.
  • Things get worse until server raises a timeout and disconnects the client because it is not able to send anything in a 30 second period.
  • The client is able to reconnect, but (since delays persist) it is disconnected again by the server. I�ve got a ~ 12 hour period of connection/delay/disconnection.
  • After this period of instability, I�ve got a ~ 12 hour period during which everything runs smoothly (status messages are delivered each 5 seconds).
  • And so on so forth.
I logged everything: OS tasks memory and CPU consumption and LWIP stats. Everything seems to be fine:

  • OS tasks don�t run out of memory and CPU consumption is under control.
  • All lwIP memory indicators are below the �available� marker and they have no errors triggered.
  • lwIP sys indicators remain below the maximum level and no errors are triggered.
  • The only thing that points to an error is the ETHARP log:
    • XMIT remains stable at 5.
    • RECV counter increases until 65.461 and then drops to 0 (I assume it is a 16 bit counter).
    • CACHEHIT increases linearly.
    • PROTERR and DROP get regularly incremented until a final value of 28.
Asking into the lwIP mailing list, a user pointed me to

http://lwip.100.n7.nabble.com/Issue-with-Cortex-Emac-driver-td25326.html

 where a possible bug in the ST ETH driver is exposed.

Anyone has experienced a similar problem? Anyone has found a solution?

Thank you very much!

Fran

#stm32f4 #!stm32-!ethernet-!dma
1 REPLY 1
Francisco Exp�sito
Associate II
Posted on April 18, 2016 at 11:10

Hi everyone,

I’ve finally managed to find the error.

ethernetif_input task was misconfigured. It was executing low_level_input just once instead of doing it repeatedly until the returned pbuffer is empty.

I started developing my communications library quite a long time ago and I took ethernetif.c from an old STM32F4 Cube lwIP example (v 1.2) which was wrong. Examples are correct starting from v 1.4.

Regards,

Fran