mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
examples: Update Ethernet examples to use new PHY LAN87xx init function
Ethernet examples device usage and Kconfig options synchronized
This commit is contained in:
@@ -162,11 +162,18 @@ menu "Example Connection Configuration"
|
|||||||
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
||||||
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_LAN8720
|
config EXAMPLE_ETH_PHY_LAN87XX
|
||||||
bool "LAN8720"
|
bool "LAN87xx"
|
||||||
help
|
help
|
||||||
|
Below chips are supported:
|
||||||
|
LAN8710A is a small footprint MII/RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
||||||
Goto https://www.microchip.com/LAN8720A for more information about it.
|
LAN8740A/LAN8741A is a small footprint MII/RMII 10/100 Energy Efficient Ethernet Transceiver
|
||||||
|
with HP Auto-MDIX and flexPWR® Technology.
|
||||||
|
LAN8742A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
|
Goto https://www.microchip.com for more information about them.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_DP83848
|
config EXAMPLE_ETH_PHY_DP83848
|
||||||
bool "DP83848"
|
bool "DP83848"
|
||||||
|
@@ -393,8 +393,8 @@ static esp_netif_t *eth_start(void)
|
|||||||
s_phy = esp_eth_phy_new_ip101(&phy_config);
|
s_phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
s_phy = esp_eth_phy_new_rtl8201(&phy_config);
|
s_phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_LAN8720
|
#elif CONFIG_EXAMPLE_ETH_PHY_LAN87XX
|
||||||
s_phy = esp_eth_phy_new_lan8720(&phy_config);
|
s_phy = esp_eth_phy_new_lan87xx(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
||||||
s_phy = esp_eth_phy_new_dp83848(&phy_config);
|
s_phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -61,11 +61,18 @@ menu "Example Configuration"
|
|||||||
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
||||||
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_LAN8720
|
config EXAMPLE_ETH_PHY_LAN87XX
|
||||||
bool "LAN8720"
|
bool "LAN87xx"
|
||||||
help
|
help
|
||||||
|
Below chips are supported:
|
||||||
|
LAN8710A is a small footprint MII/RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
||||||
Goto https://www.microchip.com/LAN8720A for more information about it.
|
LAN8740A/LAN8741A is a small footprint MII/RMII 10/100 Energy Efficient Ethernet Transceiver
|
||||||
|
with HP Auto-MDIX and flexPWR® Technology.
|
||||||
|
LAN8742A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
|
Goto https://www.microchip.com for more information about them.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_DP83848
|
config EXAMPLE_ETH_PHY_DP83848
|
||||||
bool "DP83848"
|
bool "DP83848"
|
||||||
|
@@ -92,8 +92,8 @@ void app_main(void)
|
|||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_LAN8720
|
#elif CONFIG_EXAMPLE_ETH_PHY_LAN87XX
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8041
|
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8041
|
||||||
|
@@ -32,6 +32,14 @@ menu "Example Configuration"
|
|||||||
select ETH_SPI_ETHERNET_W5500
|
select ETH_SPI_ETHERNET_W5500
|
||||||
help
|
help
|
||||||
Select external SPI-Ethernet module (W5500).
|
Select external SPI-Ethernet module (W5500).
|
||||||
|
|
||||||
|
config EXAMPLE_USE_KSZ8851SNL
|
||||||
|
bool "KSZ8851SNL Module"
|
||||||
|
select EXAMPLE_USE_SPI_ETHERNET
|
||||||
|
select ETH_USE_SPI_ETHERNET
|
||||||
|
select ETH_SPI_ETHERNET_KSZ8851SNL
|
||||||
|
help
|
||||||
|
Select external SPI-Ethernet module (KSZ8851SNL).
|
||||||
endchoice # EXAMPLE_ETHERNET_TYPE
|
endchoice # EXAMPLE_ETHERNET_TYPE
|
||||||
|
|
||||||
if EXAMPLE_USE_INTERNAL_ETHERNET
|
if EXAMPLE_USE_INTERNAL_ETHERNET
|
||||||
@@ -53,11 +61,18 @@ menu "Example Configuration"
|
|||||||
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
||||||
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_LAN8720
|
config EXAMPLE_ETH_PHY_LAN87XX
|
||||||
bool "LAN8720"
|
bool "LAN87xx"
|
||||||
help
|
help
|
||||||
|
Below chips are supported:
|
||||||
|
LAN8710A is a small footprint MII/RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
||||||
Goto https://www.microchip.com/LAN8720A for more information about it.
|
LAN8740A/LAN8741A is a small footprint MII/RMII 10/100 Energy Efficient Ethernet Transceiver
|
||||||
|
with HP Auto-MDIX and flexPWR® Technology.
|
||||||
|
LAN8742A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
|
Goto https://www.microchip.com for more information about them.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_DP83848
|
config EXAMPLE_ETH_PHY_DP83848
|
||||||
bool "DP83848"
|
bool "DP83848"
|
||||||
@@ -70,6 +85,12 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
The KSZ8041 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver.
|
The KSZ8041 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver.
|
||||||
Goto https://www.microchip.com/wwwproducts/en/KSZ8041 for more information about it.
|
Goto https://www.microchip.com/wwwproducts/en/KSZ8041 for more information about it.
|
||||||
|
|
||||||
|
config EXAMPLE_ETH_PHY_KSZ8081
|
||||||
|
bool "KSZ8081"
|
||||||
|
help
|
||||||
|
The KSZ8081 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver.
|
||||||
|
Goto https://www.microchip.com/wwwproducts/en/KSZ8081 for more information about it.
|
||||||
endchoice # EXAMPLE_ETH_PHY_MODEL
|
endchoice # EXAMPLE_ETH_PHY_MODEL
|
||||||
|
|
||||||
config EXAMPLE_ETH_MDC_GPIO
|
config EXAMPLE_ETH_MDC_GPIO
|
||||||
@@ -95,42 +116,60 @@ menu "Example Configuration"
|
|||||||
|
|
||||||
config EXAMPLE_ETH_SPI_SCLK_GPIO
|
config EXAMPLE_ETH_SPI_SCLK_GPIO
|
||||||
int "SPI SCLK GPIO number"
|
int "SPI SCLK GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 20
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 18 if IDF_TARGET_ESP32
|
||||||
|
default 20 if IDF_TARGET_ESP32S2
|
||||||
|
default 6 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI SCLK.
|
Set the GPIO number used by SPI SCLK.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_MOSI_GPIO
|
config EXAMPLE_ETH_SPI_MOSI_GPIO
|
||||||
int "SPI MOSI GPIO number"
|
int "SPI MOSI GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 19
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 23 if IDF_TARGET_ESP32
|
||||||
|
default 19 if IDF_TARGET_ESP32S2
|
||||||
|
default 7 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI MOSI.
|
Set the GPIO number used by SPI MOSI.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_MISO_GPIO
|
config EXAMPLE_ETH_SPI_MISO_GPIO
|
||||||
int "SPI MISO GPIO number"
|
int "SPI MISO GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 18
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 19 if IDF_TARGET_ESP32
|
||||||
|
default 18 if IDF_TARGET_ESP32S2
|
||||||
|
default 2 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI MISO.
|
Set the GPIO number used by SPI MISO.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_CS_GPIO
|
config EXAMPLE_ETH_SPI_CS_GPIO
|
||||||
int "SPI CS GPIO number"
|
int "SPI CS GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 21
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 16 if IDF_TARGET_ESP32
|
||||||
|
default 21 if IDF_TARGET_ESP32S2
|
||||||
|
default 10 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI CS.
|
Set the GPIO number used by SPI CS.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_CLOCK_MHZ
|
config EXAMPLE_ETH_SPI_CLOCK_MHZ
|
||||||
int "SPI clock speed (MHz)"
|
int "SPI clock speed (MHz)"
|
||||||
range 5 80
|
range 5 80
|
||||||
default 36
|
default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3
|
||||||
|
default 36 if IDF_TARGET_ESP32S2
|
||||||
help
|
help
|
||||||
Set the clock speed (MHz) of SPI interface.
|
Set the clock speed (MHz) of SPI interface.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_INT_GPIO
|
config EXAMPLE_ETH_SPI_INT_GPIO
|
||||||
int "Interrupt GPIO number"
|
int "Interrupt GPIO number"
|
||||||
default 4
|
default 17 if IDF_TARGET_ESP32
|
||||||
|
default 4 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by the SPI Ethernet module interrupt line.
|
Set the GPIO number used by the SPI Ethernet module interrupt line.
|
||||||
endif # EXAMPLE_USE_SPI_ETHERNET
|
endif # EXAMPLE_USE_SPI_ETHERNET
|
||||||
|
@@ -165,12 +165,14 @@ static void initialize_ethernet(void)
|
|||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_LAN8720
|
#elif CONFIG_EXAMPLE_ETH_PHY_LAN87XX
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8041
|
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8041
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8041(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8041(&phy_config);
|
||||||
|
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8081
|
||||||
|
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8081(&phy_config);
|
||||||
#endif
|
#endif
|
||||||
#elif CONFIG_ETH_USE_SPI_ETHERNET
|
#elif CONFIG_ETH_USE_SPI_ETHERNET
|
||||||
gpio_install_isr_service(0);
|
gpio_install_isr_service(0);
|
||||||
@@ -183,7 +185,21 @@ static void initialize_ethernet(void)
|
|||||||
.quadhd_io_num = -1,
|
.quadhd_io_num = -1,
|
||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(spi_bus_initialize(CONFIG_EXAMPLE_ETH_SPI_HOST, &buscfg, 1));
|
ESP_ERROR_CHECK(spi_bus_initialize(CONFIG_EXAMPLE_ETH_SPI_HOST, &buscfg, 1));
|
||||||
#if CONFIG_EXAMPLE_USE_DM9051
|
|
||||||
|
#if CONFIG_EXAMPLE_USE_KSZ8851SNL
|
||||||
|
spi_device_interface_config_t devcfg = {
|
||||||
|
.mode = 0,
|
||||||
|
.clock_speed_hz = CONFIG_EXAMPLE_ETH_SPI_CLOCK_MHZ * 1000 * 1000,
|
||||||
|
.spics_io_num = CONFIG_EXAMPLE_ETH_SPI_CS_GPIO,
|
||||||
|
.queue_size = 20
|
||||||
|
};
|
||||||
|
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg, &spi_handle));
|
||||||
|
/* KSZ8851SNL ethernet driver is based on spi driver */
|
||||||
|
eth_ksz8851snl_config_t ksz8851snl_config = ETH_KSZ8851SNL_DEFAULT_CONFIG(spi_handle);
|
||||||
|
ksz8851snl_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_ksz8851snl(&ksz8851snl_config, &mac_config);
|
||||||
|
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8851snl(&phy_config);
|
||||||
|
#elif CONFIG_EXAMPLE_USE_DM9051
|
||||||
spi_device_interface_config_t devcfg = {
|
spi_device_interface_config_t devcfg = {
|
||||||
.command_bits = 1,
|
.command_bits = 1,
|
||||||
.address_bits = 7,
|
.address_bits = 7,
|
||||||
|
@@ -40,6 +40,14 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
Select external SPI-Ethernet module (W5500).
|
Select external SPI-Ethernet module (W5500).
|
||||||
|
|
||||||
|
config EXAMPLE_USE_KSZ8851SNL
|
||||||
|
bool "KSZ8851SNL Module"
|
||||||
|
select EXAMPLE_USE_SPI_ETHERNET
|
||||||
|
select ETH_USE_SPI_ETHERNET
|
||||||
|
select ETH_SPI_ETHERNET_KSZ8851SNL
|
||||||
|
help
|
||||||
|
Select external SPI-Ethernet module (KSZ8851SNL).
|
||||||
|
|
||||||
config EXAMPLE_USE_ENC28J60
|
config EXAMPLE_USE_ENC28J60
|
||||||
bool "ENC28J60 Module"
|
bool "ENC28J60 Module"
|
||||||
select EXAMPLE_USE_SPI_ETHERNET
|
select EXAMPLE_USE_SPI_ETHERNET
|
||||||
@@ -68,11 +76,18 @@ menu "Example Configuration"
|
|||||||
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
||||||
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_LAN8720
|
config EXAMPLE_ETH_PHY_LAN87XX
|
||||||
bool "LAN8720"
|
bool "LAN87xx"
|
||||||
help
|
help
|
||||||
|
Below chips are supported:
|
||||||
|
LAN8710A is a small footprint MII/RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
||||||
Goto https://www.microchip.com/LAN8720A for more information about it.
|
LAN8740A/LAN8741A is a small footprint MII/RMII 10/100 Energy Efficient Ethernet Transceiver
|
||||||
|
with HP Auto-MDIX and flexPWR® Technology.
|
||||||
|
LAN8742A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
|
Goto https://www.microchip.com for more information about them.
|
||||||
|
|
||||||
config EXAMPLE_ETH_PHY_DP83848
|
config EXAMPLE_ETH_PHY_DP83848
|
||||||
bool "DP83848"
|
bool "DP83848"
|
||||||
@@ -85,6 +100,12 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
The KSZ8041 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver.
|
The KSZ8041 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver.
|
||||||
Goto https://www.microchip.com/wwwproducts/en/KSZ8041 for more information about it.
|
Goto https://www.microchip.com/wwwproducts/en/KSZ8041 for more information about it.
|
||||||
|
|
||||||
|
config EXAMPLE_ETH_PHY_KSZ8081
|
||||||
|
bool "KSZ8081"
|
||||||
|
help
|
||||||
|
The KSZ8081 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver.
|
||||||
|
Goto https://www.microchip.com/wwwproducts/en/KSZ8081 for more information about it.
|
||||||
endchoice # EXAMPLE_ETH_PHY_MODEL
|
endchoice # EXAMPLE_ETH_PHY_MODEL
|
||||||
|
|
||||||
config EXAMPLE_ETH_MDC_GPIO
|
config EXAMPLE_ETH_MDC_GPIO
|
||||||
@@ -110,29 +131,45 @@ menu "Example Configuration"
|
|||||||
|
|
||||||
config EXAMPLE_ETH_SPI_SCLK_GPIO
|
config EXAMPLE_ETH_SPI_SCLK_GPIO
|
||||||
int "SPI SCLK GPIO number"
|
int "SPI SCLK GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 20
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 18 if IDF_TARGET_ESP32
|
||||||
|
default 20 if IDF_TARGET_ESP32S2
|
||||||
|
default 6 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI SCLK.
|
Set the GPIO number used by SPI SCLK.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_MOSI_GPIO
|
config EXAMPLE_ETH_SPI_MOSI_GPIO
|
||||||
int "SPI MOSI GPIO number"
|
int "SPI MOSI GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 19
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 23 if IDF_TARGET_ESP32
|
||||||
|
default 19 if IDF_TARGET_ESP32S2
|
||||||
|
default 7 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI MOSI.
|
Set the GPIO number used by SPI MOSI.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_MISO_GPIO
|
config EXAMPLE_ETH_SPI_MISO_GPIO
|
||||||
int "SPI MISO GPIO number"
|
int "SPI MISO GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 18
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 19 if IDF_TARGET_ESP32
|
||||||
|
default 18 if IDF_TARGET_ESP32S2
|
||||||
|
default 2 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI MISO.
|
Set the GPIO number used by SPI MISO.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_CS_GPIO
|
config EXAMPLE_ETH_SPI_CS_GPIO
|
||||||
int "SPI CS GPIO number"
|
int "SPI CS GPIO number"
|
||||||
range 0 33
|
range 0 34 if IDF_TARGET_ESP32
|
||||||
default 21
|
range 0 46 if IDF_TARGET_ESP32S2
|
||||||
|
range 0 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 16 if IDF_TARGET_ESP32
|
||||||
|
default 21 if IDF_TARGET_ESP32S2
|
||||||
|
default 10 if IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by SPI CS.
|
Set the GPIO number used by SPI CS.
|
||||||
|
|
||||||
@@ -140,13 +177,15 @@ menu "Example Configuration"
|
|||||||
int "SPI clock speed (MHz)"
|
int "SPI clock speed (MHz)"
|
||||||
range 5 80
|
range 5 80
|
||||||
default 8 if EXAMPLE_USE_ENC28J60
|
default 8 if EXAMPLE_USE_ENC28J60
|
||||||
default 36
|
default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3
|
||||||
|
default 36 if IDF_TARGET_ESP32S2
|
||||||
help
|
help
|
||||||
Set the clock speed (MHz) of SPI interface.
|
Set the clock speed (MHz) of SPI interface.
|
||||||
|
|
||||||
config EXAMPLE_ETH_SPI_INT_GPIO
|
config EXAMPLE_ETH_SPI_INT_GPIO
|
||||||
int "Interrupt GPIO number"
|
int "Interrupt GPIO number"
|
||||||
default 4
|
default 17 if IDF_TARGET_ESP32
|
||||||
|
default 4 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
|
||||||
help
|
help
|
||||||
Set the GPIO number used by the SPI Ethernet module interrupt line.
|
Set the GPIO number used by the SPI Ethernet module interrupt line.
|
||||||
endif # EXAMPLE_USE_SPI_ETHERNET
|
endif # EXAMPLE_USE_SPI_ETHERNET
|
||||||
|
@@ -204,12 +204,14 @@ void register_ethernet(void)
|
|||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_LAN8720
|
#elif CONFIG_EXAMPLE_ETH_PHY_LAN87XX
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
#elif CONFIG_EXAMPLE_ETH_PHY_DP83848
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8041
|
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8041
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8041(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8041(&phy_config);
|
||||||
|
#elif CONFIG_EXAMPLE_ETH_PHY_KSZ8081
|
||||||
|
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8081(&phy_config);
|
||||||
#endif
|
#endif
|
||||||
#elif CONFIG_ETH_USE_SPI_ETHERNET
|
#elif CONFIG_ETH_USE_SPI_ETHERNET
|
||||||
gpio_install_isr_service(0);
|
gpio_install_isr_service(0);
|
||||||
@@ -221,8 +223,22 @@ void register_ethernet(void)
|
|||||||
.quadwp_io_num = -1,
|
.quadwp_io_num = -1,
|
||||||
.quadhd_io_num = -1,
|
.quadhd_io_num = -1,
|
||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(spi_bus_initialize(CONFIG_EXAMPLE_ETH_SPI_HOST, &buscfg, SPI_DMA_CH_AUTO));
|
ESP_ERROR_CHECK(spi_bus_initialize(CONFIG_EXAMPLE_ETH_SPI_HOST, &buscfg, 1));
|
||||||
#if CONFIG_EXAMPLE_USE_DM9051
|
|
||||||
|
#if CONFIG_EXAMPLE_USE_KSZ8851SNL
|
||||||
|
spi_device_interface_config_t devcfg = {
|
||||||
|
.mode = 0,
|
||||||
|
.clock_speed_hz = CONFIG_EXAMPLE_ETH_SPI_CLOCK_MHZ * 1000 * 1000,
|
||||||
|
.spics_io_num = CONFIG_EXAMPLE_ETH_SPI_CS_GPIO,
|
||||||
|
.queue_size = 20
|
||||||
|
};
|
||||||
|
ESP_ERROR_CHECK(spi_bus_add_device(CONFIG_EXAMPLE_ETH_SPI_HOST, &devcfg, &spi_handle));
|
||||||
|
/* KSZ8851SNL ethernet driver is based on spi driver */
|
||||||
|
eth_ksz8851snl_config_t ksz8851snl_config = ETH_KSZ8851SNL_DEFAULT_CONFIG(spi_handle);
|
||||||
|
ksz8851snl_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_ksz8851snl(&ksz8851snl_config, &mac_config);
|
||||||
|
esp_eth_phy_t *phy = esp_eth_phy_new_ksz8851snl(&phy_config);
|
||||||
|
#elif CONFIG_EXAMPLE_USE_DM9051
|
||||||
spi_device_interface_config_t devcfg = {
|
spi_device_interface_config_t devcfg = {
|
||||||
.command_bits = 1,
|
.command_bits = 1,
|
||||||
.address_bits = 7,
|
.address_bits = 7,
|
||||||
|
@@ -138,11 +138,18 @@ menu "Example Configuration"
|
|||||||
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX.
|
||||||
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it.
|
||||||
|
|
||||||
config SNIFFER_ETH_PHY_LAN8720
|
config SNIFFER_ETH_PHY_LAN87XX
|
||||||
bool "LAN8720"
|
bool "LAN87xx"
|
||||||
help
|
help
|
||||||
|
Below chips are supported:
|
||||||
|
LAN8710A is a small footprint MII/RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support.
|
||||||
Goto https://www.microchip.com/LAN8720A for more information about it.
|
LAN8740A/LAN8741A is a small footprint MII/RMII 10/100 Energy Efficient Ethernet Transceiver
|
||||||
|
with HP Auto-MDIX and flexPWR® Technology.
|
||||||
|
LAN8742A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and
|
||||||
|
flexPWR® Technology.
|
||||||
|
Goto https://www.microchip.com for more information about them.
|
||||||
|
|
||||||
config SNIFFER_ETH_PHY_DP83848
|
config SNIFFER_ETH_PHY_DP83848
|
||||||
bool "DP83848"
|
bool "DP83848"
|
||||||
|
@@ -142,8 +142,8 @@ static void initialize_eth(void)
|
|||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_SNIFFER_ETH_PHY_RTL8201
|
#elif CONFIG_SNIFFER_ETH_PHY_RTL8201
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||||
#elif CONFIG_SNIFFER_ETH_PHY_LAN8720
|
#elif CONFIG_SNIFFER_ETH_PHY_LAN87XX
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config);
|
||||||
#elif CONFIG_SNIFFER_ETH_PHY_DP83848
|
#elif CONFIG_SNIFFER_ETH_PHY_DP83848
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||||
#elif CONFIG_SNIFFER_ETH_PHY_KSZ8041
|
#elif CONFIG_SNIFFER_ETH_PHY_KSZ8041
|
||||||
|
Reference in New Issue
Block a user