Mongoose OS Ethernet interface

  1. My goal is:

I’d like to get decent (metric : fast, reliable) performance out of the ethernet interface (LAN8720A reference implementation).

  1. My actions are:
    I connect my ESP32 to the cloud via a LAN8720A ethernet interface chip with the MOS ethernet driver package. I attempt to do an OTA and it takes very long to download a firmware image (10x-20x slower than the wifi interface). Additionally, it seems as though the ethernet interface often drops connections inexplicably.

  2. The result I see is:

Poor OTA download speeds (20-30 minutes to download a ~2MB image, or a failure to download all together) via the ethernet interface. We also see occasional drops on TCP connections outbound from the ESP32 to another ethernet connected device.

  1. My expectation & question is:
    OTA download speeds roughly equivalent to the wifi interface on the ethernet interface. Do folks have some experience with the performance of the LAN8720A with mongoose OS ethernet drivers they can relate? This could be a pcb layout issue, and I’d be willing to share the layout/schematic if necessary…

Don’t expect a microcontroller to use the whole Eth bandwidth
If your hardware is faulty, you’ll have retransmissions.
Put an oscilloscope, see the eye pattern, put a network sniffer (Wireshark), see retransmissions, collisions, etc. Work on your LAN and preferably on a lonely switch in which you can actually do measure.

I barely remember right now, but I did use an iperf-like tool years ago on lwIP: netio; that should compile in this environment and help you track your problem.

Scaprile,
I appreciate the response. When you say “Don’t expect a microcontroller to use the whole Eth bandwidth” do you mean that I shouldn’t expect the ESP32 to realize the highest possible ethernet bandwidth (because of inherent limitations of the platform) or that you wouldn’t expect the microcontroller to be hindered by the ethernet chip?

My other observation is that the ethernet connection appears to behave “better” when I free up more heap (for example by disabling the bluetooth interface). Download speeds are still quite low though…

The “Eth chip” is just a PHY.
A microcontroller will find it very hard to fill a 100Mbps hose.
Do one thing and that thing only if you want to check the max pump ability.

Thanks for the clarification. That’s what I had assumed. I stripped down my project enough to maintain heap >90000 and in that case I still see very slow downloads on OTA. I’m basically looking for a direction to head in (ie; hardware issue or software issue) to try to improve OTA download latency.

I wouldn’t even start to try anything without first checking the hardware…
I would first check for excessive collisions, malformed/short packets, CRC errors, things that can point to a hardware issue.
If that is OK, then transferring data to/from a local host, using netio/iperf/etc. I see the newer releases of lwIP come with an iperf client, the ESP-IDF has an example here, the thruput numbers are impressive. I don’t know how difficult it is to make it compile on Mongoose-OS, it looks too coupled to me.

Last, do expected measurably poorer transfer performance on encrypted connections.

Scaprile,
Thanks for the suggestions! I’ll do some R&D in this direction and see what I can come up with…