2014-08-28 06:57 AM
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 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 #cubemx2014-09-30 10:01 AM
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.
2014-10-02 01:22 AM
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.2015-05-12 01:48 AM
Hi!
I'm really interested in your zero-copy ethernet driver. Does it work with zero-copy in both directions?