diff --git a/examples/ethernet/README.md b/examples/ethernet/README.md index 46aa134729..ffc8cdfd21 100644 --- a/examples/ethernet/README.md +++ b/examples/ethernet/README.md @@ -80,3 +80,8 @@ Please consult Espressif Technical reference manual along with datasheet for spe * The data panel between ESP32's MAC and PHY needs a fixed 50MHz clock to do synchronization, which also called RMII clock. It can either be provided by an external oscillator or generated from internal APLL. The signal integrity of RMII clock is strict, so keep the trace as short as possible! * If the RMII clock is generated from internal APLL, then APLL can't be used for other purpose (e.g. I2S). +* If you observe undefined behavior (e.g. LCD glitches) of any **SPI device** which works normally when Ethernet is not connected over internal EMAC, you need to adjust EMAC DMA burst length (the DMA is shared resource between EMAC and the SPI). The same applies when you observe Ethernet frames corruption at the output of SPI Ethernet module and you use combination of internal EMAC and SPI Ethernet module as network interfaces. To configure the EMAC DMA burst length, modify internal Ethernet initialization as follows: + +```c +esp32_emac_config.dma_burst_len = ETH_DMA_BURST_LEN_4; // or other appropriate value +``` diff --git a/examples/ethernet/basic/components/ethernet_init/ethernet_init.c b/examples/ethernet/basic/components/ethernet_init/ethernet_init.c index ffb4e3f837..f19cc4b99f 100644 --- a/examples/ethernet/basic/components/ethernet_init/ethernet_init.c +++ b/examples/ethernet/basic/components/ethernet_init/ethernet_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -69,6 +69,11 @@ static esp_eth_handle_t eth_init_internal(esp_eth_mac_t **mac_out, esp_eth_phy_t // Update vendor specific MAC config based on board configuration esp32_emac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO; esp32_emac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO; +#if CONFIG_EXAMPLE_USE_SPI_ETHERNET + // The DMA is shared resource between EMAC and the SPI. Therefore, adjust + // EMAC DMA burst length when SPI Ethernet is used along with EMAC. + esp32_emac_config.dma_burst_len = ETH_DMA_BURST_LEN_4; +#endif // CONFIG_EXAMPLE_USE_SPI_ETHERNET // Create new ESP32 Ethernet MAC instance esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); // Create new PHY instance based on board configuration @@ -175,7 +180,9 @@ static esp_eth_handle_t eth_init_spi(spi_eth_module_config_t *spi_eth_module_con .mode = 0, .clock_speed_hz = CONFIG_EXAMPLE_ETH_SPI_CLOCK_MHZ * 1000 * 1000, .queue_size = 20, - .spics_io_num = spi_eth_module_config->spi_cs_gpio + .spics_io_num = spi_eth_module_config->spi_cs_gpio, + .input_delay_ns = 20 + }; // Init vendor specific MAC config to default, and create new SPI Ethernet MAC instance // and new PHY instance based on board configuration diff --git a/examples/network/bridge/README.md b/examples/network/bridge/README.md index 23f88ea891..afedb06fbe 100644 --- a/examples/network/bridge/README.md +++ b/examples/network/bridge/README.md @@ -44,7 +44,7 @@ The work flow of the example is then as follows: ## Hardware Required -To run this example, it's recommended that you have either an official ESP32 Ethernet development board - [ESP32-Ethernet-Kit](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/get-started-ethernet-kit.html), or 3rd party ESP32 board as long as it's integrated with a supported Ethernet PHY chips, connected with supported SPI Ethernet modules (for example `DM9051`, `W5500` or `KSZ8851SNL`). Or ESP32(S/C series) board without internal Ethernet interface but connected to multiple SPI Ethernet modules. +To run this example, it's recommended that you have either an official ESP32 Ethernet development board - [ESP32-Ethernet-Kit](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/get-started-ethernet-kit.html), or 3rd party ESP32 board as long as it's integrated with a supported Ethernet PHY chips and connected with supported SPI Ethernet modules (for example `DM9051`, `W5500` or `KSZ8851SNL`). Or ESP32(S/C series) board without internal Ethernet interface but connected to multiple SPI Ethernet modules. Note that it is recommended to use multiple SPI Ethernet modules of the same type rather than combination of internal EMAC and SPI module since you don't need to take care of load balancing (internal EMAC has much higher bandwidth than SPI Ethernet modules). ### Pin Assignment diff --git a/examples/network/bridge/docs/network.drawio b/examples/network/bridge/docs/network.drawio deleted file mode 100644 index 8d846d467e..0000000000 --- a/examples/network/bridge/docs/network.drawio +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/network/bridge/docs/network.png b/examples/network/bridge/docs/network.png deleted file mode 100644 index 8d975df51b..0000000000 Binary files a/examples/network/bridge/docs/network.png and /dev/null differ