Eth_examples: added support of ESP32-S3 chip

Defined SPI modules default GPIO values for ESP32-S3

SPI bus needs to be initialized with SPI_DMA_CH_AUTO option
This commit is contained in:
Ondrej Kosta 2021-08-13 16:50:39 +02:00
parent 66b26abc87
commit 35454b2bf7
9 changed files with 152 additions and 101 deletions

View File

@ -1,5 +1,16 @@
menu "Example Connection Configuration"
config EXAMPLE_GPIO_RANGE_MIN
int
default 0
config EXAMPLE_GPIO_RANGE_MAX
int
default 33 if IDF_TARGET_ESP32
default 46 if IDF_TARGET_ESP32S2
default 19 if IDF_TARGET_ESP32C3
default 48 if IDF_TARGET_ESP32S3
config EXAMPLE_CONNECT_WIFI
bool "connect using WiFi interface"
default y
@ -184,12 +195,14 @@ menu "Example Connection Configuration"
config EXAMPLE_ETH_MDC_GPIO
int "SMI MDC GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 23
help
Set the GPIO number used by SMI MDC.
config EXAMPLE_ETH_MDIO_GPIO
int "SMI MDIO GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 18
help
Set the GPIO number used by SMI MDIO.
@ -205,41 +218,42 @@ menu "Example Connection Configuration"
config EXAMPLE_ETH_SPI_SCLK_GPIO
int "SPI SCLK GPIO number"
range 0 33
default 20
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 14
help
Set the GPIO number used by SPI SCLK.
config EXAMPLE_ETH_SPI_MOSI_GPIO
int "SPI MOSI GPIO number"
range 0 33
default 19
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 13
help
Set the GPIO number used by SPI MOSI.
config EXAMPLE_ETH_SPI_MISO_GPIO
int "SPI MISO GPIO number"
range 0 33
default 18
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 12
help
Set the GPIO number used by SPI MISO.
config EXAMPLE_ETH_SPI_CS_GPIO
int "SPI CS GPIO number"
range 0 33
default 21
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 15
help
Set the GPIO number used by SPI CS.
config EXAMPLE_ETH_SPI_CLOCK_MHZ
int "SPI clock speed (MHz)"
range 20 80
range 5 80
default 36
help
Set the clock speed (MHz) of SPI interface.
config EXAMPLE_ETH_SPI_INT_GPIO
int "Interrupt GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 4
help
Set the GPIO number used by the SPI Ethernet module interrupt line.
@ -247,6 +261,7 @@ menu "Example Connection Configuration"
config EXAMPLE_ETH_PHY_RST_GPIO
int "PHY Reset GPIO number"
range -1 EXAMPLE_GPIO_RANGE_MAX
default 5
help
Set the GPIO number used to reset PHY chip.

View File

@ -9,6 +9,7 @@ menu "Example Configuration"
default 33 if IDF_TARGET_ESP32
default 46 if IDF_TARGET_ESP32S2
default 19 if IDF_TARGET_ESP32C3
default 48 if IDF_TARGET_ESP32S3
config EXAMPLE_USE_INTERNAL_ETHERNET
depends on IDF_TARGET_ESP32
@ -150,7 +151,7 @@ menu "Example Configuration"
int "SPI SCLK GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 14 if IDF_TARGET_ESP32
default 12 if IDF_TARGET_ESP32S2
default 12 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 6 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI SCLK.
@ -159,7 +160,7 @@ menu "Example Configuration"
int "SPI MOSI GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 13 if IDF_TARGET_ESP32
default 11 if IDF_TARGET_ESP32S2
default 11 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 7 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MOSI.
@ -168,7 +169,7 @@ menu "Example Configuration"
int "SPI MISO GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 12 if IDF_TARGET_ESP32
default 13 if IDF_TARGET_ESP32S2
default 13 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 2 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MISO.
@ -177,7 +178,7 @@ menu "Example Configuration"
int "SPI clock speed (MHz)"
range 5 80
default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3
default 36 if IDF_TARGET_ESP32S2
default 36 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
help
Set the clock speed (MHz) of SPI interface.
@ -185,7 +186,7 @@ menu "Example Configuration"
int "SPI CS0 GPIO number for SPI Ethernet module #1"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 15 if IDF_TARGET_ESP32
default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by SPI CS0, i.e. Chip Select associated with the first SPI Eth module).
@ -194,7 +195,7 @@ menu "Example Configuration"
int "SPI CS1 GPIO number for SPI Ethernet module #2"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 32 if IDF_TARGET_ESP32
default 7 if IDF_TARGET_ESP32S2
default 7 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 8 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI CS1, i.e. Chip Select associated with the second SPI Eth module.
@ -202,7 +203,7 @@ menu "Example Configuration"
config EXAMPLE_ETH_SPI_INT0_GPIO
int "Interrupt GPIO number SPI Ethernet module #1"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by the first SPI Ethernet module interrupt line.
@ -211,7 +212,7 @@ menu "Example Configuration"
int "Interrupt GPIO number SPI Ethernet module #2"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 33 if IDF_TARGET_ESP32
default 5 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
default 5 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by the second SPI Ethernet module interrupt line.

View File

@ -1,5 +1,16 @@
menu "Example Configuration"
config EXAMPLE_GPIO_RANGE_MIN
int
default 0
config EXAMPLE_GPIO_RANGE_MAX
int
default 33 if IDF_TARGET_ESP32
default 46 if IDF_TARGET_ESP32S2
default 19 if IDF_TARGET_ESP32C3
default 48 if IDF_TARGET_ESP32S3
config EXAMPLE_ENC28J60_SPI_HOST
int "SPI Host Number"
range 0 2
@ -9,29 +20,36 @@ menu "Example Configuration"
config EXAMPLE_ENC28J60_SCLK_GPIO
int "SPI SCLK GPIO number"
range 0 33
default 19
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 14 if IDF_TARGET_ESP32
default 12 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 6 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI SCLK.
config EXAMPLE_ENC28J60_MOSI_GPIO
int "SPI MOSI GPIO number"
range 0 33
default 23
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 13 if IDF_TARGET_ESP32
default 11 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 7 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MOSI.
config EXAMPLE_ENC28J60_MISO_GPIO
int "SPI MISO GPIO number"
range 0 33
default 25
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 12 if IDF_TARGET_ESP32
default 13 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 2 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MISO.
config EXAMPLE_ENC28J60_CS_GPIO
int "SPI CS GPIO number"
range 0 33
default 22
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 15 if IDF_TARGET_ESP32
default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by SPI CS.
@ -44,7 +62,8 @@ menu "Example Configuration"
config EXAMPLE_ENC28J60_INT_GPIO
int "Interrupt GPIO number"
default 4
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by ENC28J60 interrupt.

View File

@ -1,5 +1,16 @@
menu "Example Configuration"
config EXAMPLE_GPIO_RANGE_MIN
int
default 0
config EXAMPLE_GPIO_RANGE_MAX
int
default 33 if IDF_TARGET_ESP32
default 46 if IDF_TARGET_ESP32S2
default 19 if IDF_TARGET_ESP32C3
default 48 if IDF_TARGET_ESP32S3
config EXAMPLE_USE_SPI_ETHERNET
bool
@ -95,12 +106,14 @@ menu "Example Configuration"
config EXAMPLE_ETH_MDC_GPIO
int "SMI MDC GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 23
help
Set the GPIO number used by SMI MDC.
config EXAMPLE_ETH_MDIO_GPIO
int "SMI MDIO GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 18
help
Set the GPIO number used by SMI MDIO.
@ -116,45 +129,36 @@ menu "Example Configuration"
config EXAMPLE_ETH_SPI_SCLK_GPIO
int "SPI SCLK GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 14 if IDF_TARGET_ESP32
default 12 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 6 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI SCLK.
config EXAMPLE_ETH_SPI_MOSI_GPIO
int "SPI MOSI GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 13 if IDF_TARGET_ESP32
default 11 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 7 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MOSI.
config EXAMPLE_ETH_SPI_MISO_GPIO
int "SPI MISO GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 12 if IDF_TARGET_ESP32
default 13 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 2 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MISO.
config EXAMPLE_ETH_SPI_CS_GPIO
int "SPI CS GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 15 if IDF_TARGET_ESP32
default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by SPI CS.
@ -162,20 +166,21 @@ menu "Example Configuration"
int "SPI clock speed (MHz)"
range 5 80
default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3
default 36 if IDF_TARGET_ESP32S2
default 36 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
help
Set the clock speed (MHz) of SPI interface.
config EXAMPLE_ETH_SPI_INT_GPIO
int "Interrupt GPIO number"
default 17 if IDF_TARGET_ESP32
default 4 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by the SPI Ethernet module interrupt line.
endif # EXAMPLE_USE_SPI_ETHERNET
config EXAMPLE_ETH_PHY_RST_GPIO
int "PHY Reset GPIO number"
range -1 EXAMPLE_GPIO_RANGE_MAX
default 5
help
Set the GPIO number used to reset PHY chip.

View File

@ -184,7 +184,7 @@ static void initialize_ethernet(void)
.quadwp_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, SPI_DMA_CH_AUTO));
#if CONFIG_EXAMPLE_USE_KSZ8851SNL
spi_device_interface_config_t devcfg = {

View File

@ -1,4 +1,16 @@
menu "Example Configuration"
config EXAMPLE_GPIO_RANGE_MIN
int
default 0
config EXAMPLE_GPIO_RANGE_MAX
int
default 33 if IDF_TARGET_ESP32
default 46 if IDF_TARGET_ESP32S2
default 19 if IDF_TARGET_ESP32C3
default 48 if IDF_TARGET_ESP32S3
config EXAMPLE_STORE_HISTORY
bool "Store command history in flash"
default y
@ -110,12 +122,14 @@ menu "Example Configuration"
config EXAMPLE_ETH_MDC_GPIO
int "SMI MDC GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 23
help
Set the GPIO number used by SMI MDC.
config EXAMPLE_ETH_MDIO_GPIO
int "SMI MDIO GPIO number"
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 18
help
Set the GPIO number used by SMI MDIO.
@ -131,45 +145,36 @@ menu "Example Configuration"
config EXAMPLE_ETH_SPI_SCLK_GPIO
int "SPI SCLK GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 14 if IDF_TARGET_ESP32
default 12 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 6 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI SCLK.
config EXAMPLE_ETH_SPI_MOSI_GPIO
int "SPI MOSI GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 13 if IDF_TARGET_ESP32
default 11 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 7 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MOSI.
config EXAMPLE_ETH_SPI_MISO_GPIO
int "SPI MISO GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 12 if IDF_TARGET_ESP32
default 13 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 2 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MISO.
config EXAMPLE_ETH_SPI_CS_GPIO
int "SPI CS GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 15 if IDF_TARGET_ESP32
default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by SPI CS.
@ -178,20 +183,21 @@ menu "Example Configuration"
range 5 80
default 8 if EXAMPLE_USE_ENC28J60
default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3
default 36 if IDF_TARGET_ESP32S2
default 36 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
help
Set the clock speed (MHz) of SPI interface.
config EXAMPLE_ETH_SPI_INT_GPIO
int "Interrupt GPIO number"
default 17 if IDF_TARGET_ESP32
default 4 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
range EXAMPLE_GPIO_RANGE_MIN EXAMPLE_GPIO_RANGE_MAX
default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by the SPI Ethernet module interrupt line.
endif # EXAMPLE_USE_SPI_ETHERNET
config EXAMPLE_ETH_PHY_RST_GPIO
int "PHY Reset GPIO number"
range -1 EXAMPLE_GPIO_RANGE_MAX
default 5
help
Set the GPIO number used to reset PHY chip.

View File

@ -234,7 +234,7 @@ void register_ethernet(void)
.quadwp_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, SPI_DMA_CH_AUTO));
#if CONFIG_EXAMPLE_USE_KSZ8851SNL
spi_device_interface_config_t devcfg = {

View File

@ -1,5 +1,16 @@
menu "Example Configuration"
config SNIFFER_GPIO_RANGE_MIN
int
default 0
config SNIFFER_GPIO_RANGE_MAX
int
default 33 if IDF_TARGET_ESP32
default 46 if IDF_TARGET_ESP32S2
default 19 if IDF_TARGET_ESP32C3
default 48 if IDF_TARGET_ESP32S3
config SNIFFER_STORE_HISTORY
bool "Store command history into flash"
default y
@ -172,12 +183,14 @@ menu "Example Configuration"
config SNIFFER_ETH_MDC_GPIO
int "SMI MDC GPIO number"
range SNIFFER_GPIO_RANGE_MIN SNIFFER_GPIO_RANGE_MAX
default 23
help
Set the GPIO number used by SMI MDC.
config SNIFFER_ETH_MDIO_GPIO
int "SMI MDIO GPIO number"
range SNIFFER_GPIO_RANGE_MIN SNIFFER_GPIO_RANGE_MAX
default 18
help
Set the GPIO number used by SMI MDIO.
@ -193,45 +206,36 @@ menu "Example Configuration"
config SNIFFER_ETH_SPI_SCLK_GPIO
int "SPI SCLK GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range SNIFFER_GPIO_RANGE_MIN SNIFFER_GPIO_RANGE_MAX
default 14 if IDF_TARGET_ESP32
default 12 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 6 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI SCLK.
config SNIFFER_ETH_SPI_MOSI_GPIO
int "SPI MOSI GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range SNIFFER_GPIO_RANGE_MIN SNIFFER_GPIO_RANGE_MAX
default 13 if IDF_TARGET_ESP32
default 11 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 7 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MOSI.
config SNIFFER_ETH_SPI_MISO_GPIO
int "SPI MISO GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range SNIFFER_GPIO_RANGE_MIN SNIFFER_GPIO_RANGE_MAX
default 12 if IDF_TARGET_ESP32
default 13 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
default 2 if IDF_TARGET_ESP32C3
help
Set the GPIO number used by SPI MISO.
config SNIFFER_ETH_SPI_CS_GPIO
int "SPI CS GPIO number"
range 0 34 if IDF_TARGET_ESP32
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
range SNIFFER_GPIO_RANGE_MIN SNIFFER_GPIO_RANGE_MAX
default 15 if IDF_TARGET_ESP32
default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by SPI CS.
@ -239,14 +243,14 @@ menu "Example Configuration"
int "SPI clock speed (MHz)"
range 5 80
default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3
default 36 if IDF_TARGET_ESP32S2
default 36 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
help
Set the clock speed (MHz) of SPI interface.
config SNIFFER_ETH_SPI_INT_GPIO
int "Interrupt GPIO number"
default 17 if IDF_TARGET_ESP32
default 4 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
range SNIFFER_GPIO_RANGE_MIN SNIFFER_GPIO_RANGE_MAX
default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3
help
Set the GPIO number used by the SPI Ethernet module interrupt line.
endif # SNIFFER_USE_SPI_ETHERNET
@ -254,6 +258,7 @@ menu "Example Configuration"
if !SNIFFER_NO_ETHERNET
config SNIFFER_ETH_PHY_RST_GPIO
int "PHY Reset GPIO number"
range -1 SNIFFER_GPIO_RANGE_MAX
default 5
help
Set the GPIO number used to reset PHY chip.

View File

@ -161,7 +161,7 @@ static void initialize_eth(void)
.quadwp_io_num = -1,
.quadhd_io_num = -1,
};
ESP_ERROR_CHECK(spi_bus_initialize(CONFIG_SNIFFER_ETH_SPI_HOST, &buscfg, 1));
ESP_ERROR_CHECK(spi_bus_initialize(CONFIG_SNIFFER_ETH_SPI_HOST, &buscfg, SPI_DMA_CH_AUTO));
#if CONFIG_SNIFFER_USE_KSZ8851SNL
spi_device_interface_config_t devcfg = {