Poor Ethernet performance on a Seeed Arch Max board

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

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

Poor Ethernet performance on a Seeed Arch Max board

Postby wgreiman » Wed Jan 14, 2015 9:55 pm

I am having performance problems with Ethernet on a Seeed Arch Max board.

https://developer.mbed.org/platforms/Seeed-Arch-Max/

I defined a new board based on a STM32F407VGT6 with a DP83848 PHY. I am a real novice at this level and was amazed when the simple web server from demos worked the first time.

I then tried sending to the board from iperf on a PC and the result was very slow. I used Wireshark to look at the packets and found short bursts with 300 ms gaps. The problem seems to be retransmissions and dup acks. The 300 ms is the timeout before retransmission.

The same test with an Olimex STM32-E407 runs at 95 Mbit/sec. The Arch Max runs at 200 Kbits/sec.

I then did a search and found this demo for a STM32F4 Discovery.

https://github.com/Nomados/STM32F4Discovery-ethernet-PHY-DP83848-demo-ChibiOS

This demo also uses a STM32F407VGT6 with a DP83848 PHY so I tried it. It has the same problem when running on the Seeed Arch Max. The web server works but iperf is slow and Wireshark shows the same problem. The connection to the PHY on the Arch Max is identical to that used by Nomados.

I found other lwip users that had the same problem with retransmissions and dup acks. Often this is either a PHY problem or a driver problem.

Any suggestions where I should look? The PHY on the Seeed Arch Max is actually a DP83848J. Also the Seeed Arch Max is just released so it may be a hardware problem since I can't find any Ethernet examples for the Arch Max.

So any suggestions on how to debug this problem would be appreciated.

The good news is that I am learning a lot about lwip and Ethernet on STM32F4.

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

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby Giovanni » Thu Jan 15, 2015 9:57 am

Hi,

I would start from the PHY datasheet and verify if this model requires additional settings or if some of the settings done in the MAC driver are not appropriate. Such a difference looks very strange so I wouldn't assume a problem with the device itself.

Giovanni

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

Re: Poor Ethernet performance on a Seeed Arch Max [Solved]

Postby wgreiman » Fri Jan 16, 2015 9:34 pm

I found and fixed the problem.

The Auto-Negotiation strapping is the reset state of the LED link and speed pins. Unfortunately Seeed copied the example in the DP83848J datasheet which results in Auto-Negotiation with 10BASE-T Half-Duplex and 100BASE-TX Half-Duplex advertised.

This is the fix:

Code: Select all

static void phyFix(void) {
  uint32_t reg = mii_read(&ETHD1, MII_ADVERTISE);
  reg |= ADVERTISE_10HALF|ADVERTISE_10FULL|ADVERTISE_100HALF|ADVERTISE_100FULL;
  mii_write(&ETHD1, MII_ADVERTISE , reg);
}

I am not sure where the best place is to call this. I call it after starting the lwip_thread.

The Arch Max board now has the same performance as the Olimex STM32-E407 board, about 95 Mbits/sec.

The WaveShare DP83848 module used by Nomados with the STM32F4 Discovery has the LEDs wired so Auto-Negotiation is correct.

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

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby Giovanni » Fri Jan 16, 2015 9:44 pm

Great work.

About the initialization, may be it could go in the initialization phase, there is a hook that can be used for that: BOARD_PHY_RESET() which is meant for custom PHY initializations.

Giovanni

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

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby wgreiman » Sat Jan 17, 2015 8:21 pm

The BOARD_PHY_RESET() hook is perfect.

I put the custom PHY reset code in board.c, defined BOARD_PHY_RESET in board.h, and it worked the first time. ChibiOS is such a pleasure to use.

GunterO
Posts: 24
Joined: Tue Feb 03, 2015 9:59 am

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby GunterO » Mon Mar 02, 2015 1:42 pm

Hi.
I have this board since today, and was searching this forum and landed here. Are you willing to share a basic webserver project?
Are you still using mbed, or did you switch to another IDE/Toolchain? I'm using Keil's µVision, and hope to use the Seeed Arch Max with this IDE.

Thanks!

ddrown
Posts: 3
Joined: Fri Jul 01, 2016 4:16 am

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby ddrown » Fri Jul 01, 2016 4:23 am

GunterO wrote:Hi.
I have this board since today, and was searching this forum and landed here. Are you willing to share a basic webserver project?
Are you still using mbed, or did you switch to another IDE/Toolchain? I'm using Keil's µVision, and hope to use the Seeed Arch Max with this IDE.

Thanks!


I went ahead and created an os/hal/boards/SEEED_ARCH_MAX/ based off of the OLIMEX_STM32_E407 (attached as hal-boards-SEEED_ARCH_MAX.zip)

I included the BOARD_PHY_RESET auto-negotiation code, and it negotiates 100/Full for me.

I also modified the RT-STM32F407-OLIMEX_E407-LWIP-FATFS-USB demo in demos/STM32/ (attached as demos-RT-STM32F407-ARCH-MAX.zip)

The debug serial shell, the LED blink, the sdcard, and the webserver are all working for me in this demo. Note: the sdcard is attached via SPI instead of SDIO.
Attachments
demos-RT-STM32F407-ARCH-MAX.zip
(39.93 KiB) Downloaded 197 times
hal-boards-SEEED_ARCH_MAX.zip
(10.73 KiB) Downloaded 200 times

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

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby Giovanni » Fri Jul 01, 2016 7:49 am

Hi,

Is the demo for version 16.1 or for trunk code?

GIovanni

ddrown
Posts: 3
Joined: Fri Jul 01, 2016 4:16 am

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby ddrown » Fri Jul 01, 2016 2:47 pm

Giovanni wrote:Hi,

Is the demo for version 16.1 or for trunk code?

GIovanni


I was using 16.1, how different is trunk?

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

Re: Poor Ethernet performance on a Seeed Arch Max board

Postby Giovanni » Fri Jul 01, 2016 3:11 pm

Board files are exactly the same, there are differences in usbcfg.c and various other details.

In general it is best to work on trunk code because stable branches do not receive new features, only bug fixes.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 10 guests