cancel
Showing results for 
Search instead for 
Did you mean: 

Low TCP/IP transmit perormance with STM32CubeMX and STM32F429ZG

Michael Steinecke
Associate II
Posted on August 28, 2014 at 15:57

Hello,

currently I'm porting a STM32F103ZG / Wiznet W5300 Ethernet and SPL based  to a STM32F429ZG / STM32CubeMX / LwIP based application. Both versions using FreeRTOS. In both cases its a custom board.

I'm struggling on a quite low performance of the Ethernet part. The application transmits a large amount of data from the SD Card to a remote PC using the TCP RAW API of LwIP. The transmit rate is about 20 kB/s. Currently, I guess the biggest berformance gain would be optimizing the low level Ethernet device driver.

low_level_output() needs about 25 us for 60 bytes and 200us for 1524 bytes. This indicates a limitation to ~45 MBit/s just by writing data to the output. And then, the device would had no time to do anything else.

low_level_output() uses memcpy() to copy the data. Is this an actual DMA transfer or CPU bound work?

In my case, the copy wouldn't necessary at all. With LwIP, all the data is statically in the RAM, as long as the package hasn't been acknowledged. Is there a zero-copy driver implementation around? There is a big

http://forum.chibios.org/phpbb/viewtopic.php?f=3&t=857

in the ChibiOS forums, regarding that topic. Has someone already tried to use their findings together with the CubeMX driver and FreeRTOS? Unfortunately, I'm unable to download the Dropbox stuff from work.

Any other tips to increase the performance?

Versions used:

STM32F429ZG 180 MHz clock

IM2516SDBATG 16 MB SDRAM holding the buffered data

STM32CubeMX V4.3.0 together with FW lib 1.3.0

FreeRTOS 7.60

LwIP V4.1.? (provided by Cube)

#tcp/ip #stm32 #lwip #stm32f4 #cubemx
12 REPLIES 12
Oussema Hajjem_O
Associate III
Posted on September 30, 2014 at 19:01

Hi Michael,

Yes it will be the same idea, just I don't see the need of using ''

pendingRxFrames''

because the semaphore is binary so once released it couldn't be released again until it will be taken.

  

From my part I suggest this solution:

void ethernetif_input( void const * argument )

{

  struct pbuf *p;

  struct netif *netif = (struct netif *) argument;

  

  for( ;; )

  {

    if (osSemaphoreWait( s_xSemaphore, TIME_WAITING_FOR_INPUT)==osOK)

    {

      do

      {

        p = low_level_input( netif );

        if   (p != NULL)

        {

          if (netif->input( p, netif) != ERR_OK )

          {

            pbuf_free(p);

          }

        }

      }while(p!=NULL);

    }

  }

}

This fix will be available in the next release of STM32Cube 

Regards.

Michael Steinecke
Associate II
Posted on October 02, 2014 at 10:22

FreeRTOS asserts a Semaphore- or QueueFull error without

the pendingRxFrames, on subsequent interrupts

. In default, this assert is not reported. It's bad design to let this happen, in my opinion. Someone may struggle on this, later on.

metin2
Associate
Posted on May 12, 2015 at 10:48

Hi!

I'm really interested in your zero-copy ethernet driver. Does it work with zero-copy in both directions?