Improved Ethernet library for M-Duino and ESP32 PLCs

November 14, 2024 by
Boot & Work Corp. S.L., Arnau Tena

We've improved the Ethernet library to allow the configuration of the operating modes of the port.

Installation

The improved Ethernet library is available with version 1.1.45 of the M-Duino boards package and version 2.3.0 of the ESP32 PLC boards package.

To install the boards package, follow the seps from this blog:

How to install Industrial Shields boards in the Arduino IDE

If you have Arduino's Ethernet library installed in Documents/Arduino/libraries, Arduino IDE may choose to use that one instead of the Industrial Shields one.

Usage

By default the Ethernet is configured to be all-capable with auto-negotiation enabled, but it can be changed by calling the PHYconf method:

Ethernet.PHYconf(PHY::H100);

These are all the operating modes you can choose from:


Bits

Description

PHY::H10

000

10BT Half-duplex, Auto-negotiation disabled

PHY::F10

001

10BT Full-duplex, Auto-negotiation disabled

PHY::H100

010

100BT Half-duplex, Auto-negotiation disabled

PHY::F100

011

100BT Full-duplex, Auto-negotiation disabled

PHY::H100Auto

100

100BT Half-duplex, Auto-negotiation enabled

PHY::Off

110

Power Down mode

PHY::All

111

All capable, Auto-negotiation enabled

The bits listed above represent the bits in the positions 5, 4 and 3 of the PHYCFGR register.

You can check what mode the Ethernet is currently in by using the PHYget method:

Ethernet.PHYget();

This will return the current value of the PHYCFGR register in decimal, so to check the bits 5, 4 and 3 you'll have to convert it to binary.

Measured response time

We've run a few tests to measure the response time of the Ethernet port, here are the results:


Min

Avg

Max

14IOS 100BT

0.661 ms

1.101 ms

1.575 ms

14IOS 10BT

0.999 ms

1.831 ms

2.531 ms

ESP32 100BT

0.355 ms

0.982 ms

1.449 ms

ESP32 10BT

0.976 ms

1.713 ms

7.789 ms

M-Duino 100BT

0.375 ms

0.995 ms

1.792 ms

M-Duino 10BT

0.747 ms

1.772 ms

8.835 ms


​Search in our Blog

Boot & Work Corp. S.L., Arnau Tena November 14, 2024
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>