Jump to content

Component: Ethernet (ESP32) (Comms: Networking)

From Flowcode Help
Author Matrix Ltd.
Version 1.0
Category Comms: Networking


Ethernet (ESP32) component

Wired Ethernet component for ESP32 modules with an RMII PHY, such as the Olimex ESP32-POE, ESP32-POE-ISO and ESP32-GATEWAY. The socket macro interface is identical to the WLAN (ESP32) component so the Network Comms, Web Server, MQTT and other network layers work unchanged on top of it.

Version information

Library Version, Component Version, Date, Author, Info

1, 1.0, 23-10-26, BR, Component created - wired Ethernet for ESP32 with RMII PHY (ESP32-POE). Socket interface identical to WLAN (ESP32), wireless-only macros removed, Initialise brings the link up and Deinitialise tears it down


Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Macro reference

AcceptClose

AcceptClose
Close the socket associated with the Accepted incoming connection 
- VOID Return


AcceptOpen

AcceptOpen
Returns 1 if there is an incoming connection on the listening port 
- BYTE Return


Deinitialise

Deinitialise
Stops the Ethernet link, removes the driver and powers down the PHY.

Call Initialise again to bring the network back up. Returns 1 if successful Returns 0 if not 

- BYTE Return


Initialise

Initialise
Initialises the Ethernet MAC, PHY and network interface, brings the link up and waits for an IP address (DHCP) or for the cable link (static IP).

The maximum wait is set by the Connect Timeout property. Returns 1 once the network is ready Returns 0 on failure or timeout 

- BYTE Return


ReadIP

ReadIP
Collects a single byte from the local IP address.

For example 192.168.0.1 Index = 3 : Return = 192 / Index = 0 : Return = 1 

- BYTE Index
Range: 0 to 3 Where 3 = the first number and 0 = the last number 
- BYTE Return


ReadIPString

ReadIPString
Collects the local IP address and returns it as an ASCII string.

e.g. "192.168.0.1" 

- STRING Return


ReadLinkStatus

ReadLinkStatus
Returns 1 if the Ethernet cable link is up, 0 if the link is down. 
- BYTE Return


ReadMACString

ReadMACString
Returns the MAC address of the Ethernet interface as an ASCII string.

e.g. "24:0A:C4:12:34:56" 

- STRING Return


SocketClose

SocketClose
 
- VOID Return


SocketConnect

SocketConnect
 
- STRING Address
 
- UINT Port
 
- BYTE Return


SocketListen

SocketListen
Listen on, or bind, local port to already opened socket.

Returns 1 if OK, 0 if fail 

- UINT Port
 
- BYTE Return


SocketOpen

SocketOpen
Returns 1 if socket sucessfully opened 
- BYTE Return


SocketRead

SocketRead
 
- STRING Buffer
 
- UINT Size
 
- UINT Return


SocketWrite

SocketWrite
 
- STRING Buffer
 
- UINT Size
 
- UINT Return


Property reference

Properties
Verbose Debug
Provides verbose debugging output via hardware UART channel 1 which is often connected to a UART to USB bridge.

 

PHY Hardware
PHY Type
Ethernet PHY chip connected to the ESP32 RMII interface.

ESP32-POE / ESP32-POE-ISO / ESP32-GATEWAY use the LAN8710A (LAN87xx driver). WT32-ETH01 uses the LAN8720A (LAN87xx driver). 

PHY Address
SMI address of the PHY chip, normally 0 or 1.

Set to -1 to auto detect. 

PHY Power GPIO
GPIO number used to switch on power to the PHY.

ESP32-POE uses GPIO12. Set to -1 if the PHY is always powered. 

PHY Reset GPIO
GPIO number connected to the PHY reset pin.

Set to -1 if not connected (ESP32-POE). 

MDC GPIO
GPIO number used for the SMI management clock (MDC).

ESP32-POE uses GPIO23. 

MDIO GPIO
GPIO number used for the SMI management data (MDIO).

ESP32-POE uses GPIO18. 

RMII Clock
Source of the 50MHz RMII reference clock.

ESP32-POE / ESP32-GATEWAY: Inverted output on GPIO17. WT32-ETH01: External input on GPIO0. 

Network Configuration
Connect Timeout
Maximum number of seconds Initialise waits for the cable link and, when DHCP is enabled, an IP address before giving up.

Default 20 

DHCP
Enable DHCP to automatically obtain the IP address, subnet mask, gateway and DNS server from a DHCP server.

When enabled the static IP Address, Subnet Mask and Gateway IP properties are not used. 

IP Address
IP0
First octet of the static IP address (e.g. 192 in 192.168.1.100). Ignored when DHCP is enabled. 
IP1
Second octet of the static IP address. Ignored when DHCP is enabled. 
IP2
Third octet of the static IP address. Ignored when DHCP is enabled. 
IP3
Fourth octet of the static IP address (e.g. 100 in 192.168.1.100). Ignored when DHCP is enabled. 
Subnet Mask
Subnet0
First octet of the subnet mask (e.g. 255 for 255.255.255.0). Ignored when DHCP is enabled. 
Subnet1
Second octet of the subnet mask. Ignored when DHCP is enabled. 
Subnet2
Third octet of the subnet mask. Ignored when DHCP is enabled. 
Subnet3
Fourth octet of the subnet mask (e.g. 0 for 255.255.255.0). Ignored when DHCP is enabled. 
Gateway IP
Gateway0
First octet of the default gateway IP address (e.g. 192 in 192.168.1.1). Ignored when DHCP is enabled. 
Gateway1
Second octet of the default gateway IP address. Ignored when DHCP is enabled. 
Gateway2
Third octet of the default gateway IP address. Ignored when DHCP is enabled. 
Gateway3
Fourth octet of the default gateway IP address (e.g. 1 in 192.168.1.1). Ignored when DHCP is enabled. 
DNS Server
DNS0
First octet of the DNS server IP address (e.g. 8 in 8.8.8.8). Used in static IP mode; also acts as fallback if DHCP does not provide a DNS server. 
DNS1
Second octet of the DNS server IP address. 
DNS2
Third octet of the DNS server IP address. 
DNS3
Fourth octet of the DNS server IP address. Google Public DNS default. 
Simulation
Network Interface
List of network interfaces connected to the PC.

Sets which interface we are communicating via. 

Console Data
Generate Console Data 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_ETH_ESP32.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_ETH_ESP32.fcfx