2021-06-20 00:14:09 +02:00
|
|
|
#ifndef WLED_ETHERNET_H
|
|
|
|
#define WLED_ETHERNET_H
|
|
|
|
|
|
|
|
#ifdef WLED_USE_ETHERNET
|
2021-08-23 14:14:48 +02:00
|
|
|
#include "pin_manager.h"
|
|
|
|
|
|
|
|
// The following six pins are neither configurable nor
|
|
|
|
// can they be re-assigned through IOMUX / GPIO matrix.
|
|
|
|
// See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit-v1.1.html#ip101gri-phy-interface
|
|
|
|
const managed_pin_type esp32_nonconfigurable_ethernet_pins[6] = {
|
|
|
|
{ 21, true }, // RMII EMAC TX EN == When high, clocks the data on TXD0 and TXD1 to transmitter
|
|
|
|
{ 19, true }, // RMII EMAC TXD0 == First bit of transmitted data
|
|
|
|
{ 22, true }, // RMII EMAC TXD1 == Second bit of transmitted data
|
|
|
|
{ 25, false }, // RMII EMAC RXD0 == First bit of received data
|
|
|
|
{ 26, false }, // RMII EMAC RXD1 == Second bit of received data
|
|
|
|
{ 27, true }, // RMII EMAC CRS_DV == Carrier Sense and RX Data Valid
|
|
|
|
};
|
|
|
|
|
|
|
|
// For ESP32, the remaining five pins are at least somewhat configurable.
|
|
|
|
// eth_address is in range [0..31], indicates which PHY (MAC?) address should be allocated to the interface
|
|
|
|
// eth_power is an output GPIO pin used to enable/disable the ethernet port (and/or external oscillator)
|
|
|
|
// eth_mdc is an output GPIO pin used to provide the clock for the management data
|
|
|
|
// eth_mdio is an input/output GPIO pin used to transfer management data
|
|
|
|
// eth_type is the physical ethernet module's type (ETH_PHY_LAN8720, ETH_PHY_TLK110)
|
|
|
|
// eth_clk_mode defines the GPIO pin and GPIO mode for the clock signal
|
|
|
|
// However, there are really only four configurable options on ESP32:
|
|
|
|
// ETH_CLOCK_GPIO0_IN == External oscillator, clock input via GPIO0
|
|
|
|
// ETH_CLOCK_GPIO0_OUT == ESP32 provides 50MHz clock output via GPIO0
|
|
|
|
// ETH_CLOCK_GPIO16_OUT == ESP32 provides 50MHz clock output via GPIO16
|
|
|
|
// ETH_CLOCK_GPIO17_OUT == ESP32 provides 50MHz clock output via GPIO17
|
2021-06-20 00:14:09 +02:00
|
|
|
typedef struct EthernetSettings {
|
|
|
|
uint8_t eth_address;
|
|
|
|
int eth_power;
|
|
|
|
int eth_mdc;
|
|
|
|
int eth_mdio;
|
|
|
|
eth_phy_type_t eth_type;
|
|
|
|
eth_clock_mode_t eth_clk_mode;
|
|
|
|
} ethernet_settings;
|
|
|
|
|
|
|
|
ethernet_settings ethernetBoards[] = {
|
|
|
|
// None
|
|
|
|
{
|
|
|
|
},
|
|
|
|
|
|
|
|
// WT32-EHT01
|
2021-08-23 14:14:48 +02:00
|
|
|
// (*) NOTE: silkscreen on board revision v1.2 may be wrong:
|
|
|
|
// silkscreen on v1.2 says IO35, but appears to be IO5
|
|
|
|
// silkscreen on v1.2 says RXD, and appears to be IO35
|
2021-06-20 00:14:09 +02:00
|
|
|
{
|
|
|
|
1, // eth_address,
|
|
|
|
16, // eth_power,
|
|
|
|
23, // eth_mdc,
|
|
|
|
18, // eth_mdio,
|
|
|
|
ETH_PHY_LAN8720, // eth_type,
|
|
|
|
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
|
|
|
},
|
|
|
|
|
|
|
|
// ESP32-POE
|
|
|
|
{
|
|
|
|
0, // eth_address,
|
|
|
|
12, // eth_power,
|
|
|
|
23, // eth_mdc,
|
|
|
|
18, // eth_mdio,
|
|
|
|
ETH_PHY_LAN8720, // eth_type,
|
|
|
|
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
|
|
|
},
|
|
|
|
|
|
|
|
// WESP32
|
|
|
|
{
|
|
|
|
0, // eth_address,
|
|
|
|
-1, // eth_power,
|
|
|
|
16, // eth_mdc,
|
|
|
|
17, // eth_mdio,
|
|
|
|
ETH_PHY_LAN8720, // eth_type,
|
|
|
|
ETH_CLOCK_GPIO0_IN // eth_clk_mode
|
|
|
|
},
|
|
|
|
|
|
|
|
// QuinLed-ESP32-Ethernet
|
|
|
|
{
|
|
|
|
0, // eth_address,
|
|
|
|
5, // eth_power,
|
|
|
|
23, // eth_mdc,
|
|
|
|
18, // eth_mdio,
|
|
|
|
ETH_PHY_LAN8720, // eth_type,
|
|
|
|
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
|
|
|
},
|
|
|
|
|
|
|
|
// TwilightLord-ESP32 Ethernet Shield
|
|
|
|
{
|
|
|
|
0, // eth_address,
|
|
|
|
5, // eth_power,
|
|
|
|
23, // eth_mdc,
|
|
|
|
18, // eth_mdio,
|
|
|
|
ETH_PHY_LAN8720, // eth_type,
|
|
|
|
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
|
|
|
},
|
|
|
|
|
|
|
|
// ESP3DEUXQuattro
|
|
|
|
{
|
|
|
|
1, // eth_address,
|
|
|
|
-1, // eth_power,
|
|
|
|
23, // eth_mdc,
|
|
|
|
18, // eth_mdio,
|
|
|
|
ETH_PHY_LAN8720, // eth_type,
|
|
|
|
ETH_CLOCK_GPIO17_OUT // eth_clk_mode
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|