STM32-E407 Ethernet performance!

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
wgreiman
Posts: 33
Joined: Sun Oct 23, 2011 3:21 pm
Been thanked: 2 times

STM32-E407 Ethernet performance!

Postby wgreiman » Fri Jan 02, 2015 9:38 pm

This is just a thank-you for amazing Ethernet performance on an Olimex STM32-E407 Rev E board.

I am astounded, I hacked an iperf implementation for the board and increased lwip parameters so I could run 10 parallel streams.

Here is the result connecting from a Mint 17.1 Linux PC:
bill@mint17 ~ $ iperf -c192.168.2.20 -P10
------------------------------------------------------------
Client connecting to 192.168.2.20, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[ 12] local 192.168.2.172 port 56861 connected with 192.168.2.20 port 5001
[ 4] local 192.168.2.172 port 56853 connected with 192.168.2.20 port 5001
[ 3] local 192.168.2.172 port 56852 connected with 192.168.2.20 port 5001
[ 6] local 192.168.2.172 port 56855 connected with 192.168.2.20 port 5001
[ 5] local 192.168.2.172 port 56854 connected with 192.168.2.20 port 5001
[ 8] local 192.168.2.172 port 56857 connected with 192.168.2.20 port 5001
[ 7] local 192.168.2.172 port 56856 connected with 192.168.2.20 port 5001
[ 9] local 192.168.2.172 port 56858 connected with 192.168.2.20 port 5001
[ 10] local 192.168.2.172 port 56859 connected with 192.168.2.20 port 5001
[ 11] local 192.168.2.172 port 56860 connected with 192.168.2.20 port 5001
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.1 sec 11.5 MBytes 9.53 Mbits/sec
[ 3] 0.0-10.1 sec 11.5 MBytes 9.53 Mbits/sec
[ 6] 0.0-10.1 sec 11.5 MBytes 9.53 Mbits/sec
[ 8] 0.0-10.1 sec 11.5 MBytes 9.53 Mbits/sec
[ 7] 0.0-10.1 sec 11.5 MBytes 9.53 Mbits/sec
[ 9] 0.0-10.1 sec 11.5 MBytes 9.53 Mbits/sec
[ 12] 0.0-10.1 sec 11.2 MBytes 9.31 Mbits/sec
[ 5] 0.0-10.1 sec 11.5 MBytes 9.52 Mbits/sec
[ 10] 0.0-10.1 sec 11.5 MBytes 9.52 Mbits/sec
[ 11] 0.0-10.1 sec 11.5 MBytes 9.52 Mbits/sec
[SUM] 0.0-10.1 sec 115 MBytes 95.0 Mbits/sec

The result is 95 Mbit/sec for any parallelism from 1 to 10. Wow!

wgreiman
Posts: 33
Joined: Sun Oct 23, 2011 3:21 pm
Been thanked: 2 times

Re: STM32-E407 Ethernet performance!

Postby wgreiman » Sat Jan 03, 2015 4:19 pm

Here is a bit more information. I noticed that all results are just below 95 Mbits/sec so I decided to calculate the theoretical maximum receive rate.

Here are the sizes of TCP over Ethernet.

Ethernet Frame Size 1518 Bytes
Ethernet Preamble 8 Bytes
Interframe Gap 12 Bytes
Total Inter-Frame Time 1538 Bytes
Ethernet Overhead 38 Bytes
Ethernet Data 1500 Bytes
IP Datagram Overhead 20 Bytes
TCP Datagram Overhead 20 Bytes
Maximum User Data per Ethernet Frame 1460 Bytes


So the data in a frame is 1460 bytes but with all overhead, 1538 bytes are sent. So the maximum rate is (100 Mbits/sec)*1460/1538 = 94.93 Mbits/sec.

This means the MAC driver must receive frames at the maximum rate. Is this possible or am I missing something?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32-E407 Ethernet performance!

Postby Giovanni » Sat Jan 03, 2015 6:43 pm

Hi,

Not sure but considering that the driver does some buffering it should be possible, the core is fast enough for sure.

Giovanni

dalbert
Posts: 16
Joined: Mon Mar 02, 2015 8:02 pm

STM32-E407 demo frustration

Postby dalbert » Thu Mar 05, 2015 2:45 am

I am new to ChibiOS, but a very experienced embedded developer; I'm intrigued by the elegant OS design but have been frustrated by the difficulty in getting the demos working and can see why the primary criticism of Chibi is the lack of documentation for beginners. I won't just whine about this, I'll be happy to contribute some documentation once I get to know the OS better.

My first goal is to get an STM32F4 Ethernet demo working. I'm trying first with the recommended Olimex STM32-E407. The adventure starts as soon as you try to build the demo. In 2.6.7, the STM32-E407 demo requires (without mention) that you need to unzip the lwip and fatfs libraries in ChibiOS/ext in order to build. More problematic for a new user is that the demo points to an older version of the board in the Makefile...I have board rev E (and so will nearly anyone else who is starting with ChibiOS). If you slog through the board posts, you'll find out that you need to change the board reference in the Makefile to OLIMEX_STM32_E407_REV_D. Unfortunately, when you build using either version of the board library and load it onto a rev E STM32-E407, the demo just hangs (no blinky LED, no virtual COM port). Note that I've built all the STM32F4-DISCOVERY demos and they worked fine (also with varying degrees of frustration trying to get them to build). I've even gotten the rather nice PPP over serial demo running on the F4 Discovery board that also uses lwIP.

The situation with the 3.0.0 development head is (understandably) worse; LwIP and FatFS are not included in the 3.0.0 directory tree at all so I copied them from the 2.6.7 /ext folder to the 3.0.0 os/ext folder, but link fails with several network functions undefined (see below).

build/obj/netif.o: In function `netif_set_up':
C:\Users\dalbert\Documents\NetBeansProjects\stm32f4-chibios-lwip-pppos/lib/lwip/src/core/netif.c:468: undefined reference to `etharp_request'
build/obj/netif.o: In function `netif_set_down':
C:\Users\dalbert\Documents\NetBeansProjects\stm32f4-chibios-lwip-pppos/lib/lwip/src/core/netif.c:500: undefined reference to `etharp_cleanup_netif'
build/obj/timers.o: In function `arp_timer':
C:\Users\dalbert\Documents\NetBeansProjects\stm32f4-chibios-lwip-pppos/lib/lwip/src/core/timers.c:139: undefined reference to `etharp_tmr'
build/obj/tcpip.o: In function `tcpip_thread':
C:\Users\dalbert\Documents\NetBeansProjects\stm32f4-chibios-lwip-pppos/lib/lwip/src/api/tcpip.c:103: undefined reference to `ethernet_input'
collect2.exe: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1

Eventually, I'll figure this out, but if anyone has been successful with this (and it looks like some folks have), I'd love to know what the magic incantations were to get the LWIP-FATFS-USB demo working on a rev E STM32-E407. Thanks!

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32-E407 Ethernet performance!

Postby Giovanni » Thu Mar 05, 2015 9:08 am

Hi,

It should be sufficient to swap the board files in the makefile. Porting is covered here: http://www.chibios.org/dokuwiki/doku.ph ... port_guide
The fun thing that there are complaints about the documentation being both insufficient and excessive. probably it is just insufficiently organized.

About the board, I don't have a revision E yet so that code has been placed there as contributed but I know that it has been used.

Finally about beginners, there is this new site dedicated to ChibiOS: http://www.playembedded.org hopefully it will become the resource for new users. There is also a dedicated book in the pipeline.

Giovanni

dalbert
Posts: 16
Joined: Mon Mar 02, 2015 8:02 pm

Re: STM32-E407 Ethernet performance!

Postby dalbert » Thu Mar 05, 2015 5:14 pm

I found an old STM32-E407 rev B at home and the demo builds and runs correctly on it.
This suggests that the problem is that the REV_D board doesn't work with rev E hardware; I'll look into this.

Please consider that this demo is tough for a new user. It would be nice if the readme stated:

- unzip ext/lwip-1.4.1_patched.zip to ext/lwip
- unzip ext/fatfs-0.9_patched.zip to ext/fatfs
- the STM32-E407 has multiple incompatible hardware versions and you must use the proper board version for your board.
This is set in the Makefile on line 72:
revs A,B,C : OLIMEX_STM32_E407
revs D: OLIMEX_STM32_E407_REV_D
revs E+: not supported
- the IP and MAC address are hard coded in os/various/lwip_bindings/lwip_thread.h
- connect to the OTG1 USB connector to get a virtual COM port with a command line interface
- when running the demo, the green LED should be blinking

It would be much nicer if the demo supported DHCP and a shell command to display the IP address (I'll work on those too).
Note too that under ChibiOS 3.0.0 this demo does not build.

Thanks again for ChibiOS and for your help!!!

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32-E407 Ethernet performance!

Postby Giovanni » Thu Mar 05, 2015 6:12 pm

Never used DHCP with lwIP, I am not an lwIP expert except than for integration layer, any help there would be really appreciated.

Giovanni

dalbert
Posts: 16
Joined: Mon Mar 02, 2015 8:02 pm

Re: STM32-E407 Ethernet performance!

Postby dalbert » Thu Mar 05, 2015 10:12 pm

It is easy to activate DHCP...when I finish updating files to include the instructions I listed before, I'll send them to you and you can decide whether to include them in the next release. (or should I just use git?)

In a nutshell:
In lwipopts, change LWIP_DCHP from 0 to 1
In lwipthread.c:
add: #include "lwip/dhcp.h"
insert after netif_set_up(&thisif);: dhcp_start(&thisif);

Regards,
Dave

dalbert
Posts: 16
Joined: Mon Mar 02, 2015 8:02 pm

Re: STM32-E407 Ethernet performance!

Postby dalbert » Fri Mar 06, 2015 2:11 pm

Hi Giovanni,

Attached are a small set of changes to the 2.6.7 LWIP-FATFS-USB demo that do the following:
  • Adds automatic DHCP support
  • adds "ifconfig" command to the shell to display IP and MAC addresses, link state, etc.
  • adds "ping" command to shell
  • adds comments to readme.txt to help user build the demo
I tested this with my rev B Olimex STM32-E407 and it worked nicely.

As time permits, I will figure out why the rev E hardware does not work and will submit a REV_E board file...this seems important since anyone buying a new STM32-E407 will receive rev E hardware that appears not to work with the REV_D board file.

Regards,
Dave
Attachments
LWIP-FATFS-USB_Changes.zip
Changes to STM32-E407 LWIP/FATFS/USB demo to support DHCP and additional commands
(32.61 KiB) Downloaded 344 times

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32-E407 Ethernet performance!

Postby Giovanni » Fri Mar 06, 2015 3:12 pm

Great, I will give it a try during the weekend.

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 29 guests