ESPHome
2026.6.0-dev
Loading...
Searching...
No Matches
esphome
components
ethernet
w5500_custom_spi.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/defines.h
"
4
5
#if defined(USE_ESP32) && defined(USE_ETHERNET_W5500)
6
7
#include <esp_idf_version.h>
8
// IDF 6.0 moved the per-chip SPI MAC drivers to the Espressif Component Registry; eth_w5500_config_t
9
// is no longer reachable through esp_eth.h and needs the explicit header.
10
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
11
#include <esp_eth_mac_w5500.h>
12
#else
13
#include <esp_eth.h>
14
#endif
15
16
namespace
esphome::ethernet
{
17
18
// Installs a custom W5500 SPI driver that offloads the bulk frame transfers off the busy-wait path.
19
//
20
// The stock W5500 driver runs every SPI transfer through spi_device_polling_transmit(), which
21
// busy-waits the CPU for the whole transfer. The frame payload (one large read per received frame,
22
// one large write per transmitted frame) is by far the biggest transfer, so the RX task and the TX
23
// caller each spin for hundreds of microseconds per frame. This driver sends payload transfers
24
// through the blocking, interrupt-driven spi_device_transmit() instead, so the calling task sleeps
25
// while DMA moves the bytes. Small register accesses stay on the polling path, where the busy-wait
26
// is cheaper than an interrupt round-trip.
27
//
28
// Must be called before esp_eth_mac_new_w5500(). The driver reads spi_host_id and spi_devcfg back
29
// out of `config` in its init() callback, so `config` (and the spi_devcfg it points at) must stay
30
// alive until esp_eth_mac_new_w5500() returns.
31
void
install_w5500_async_spi
(eth_w5500_config_t &config);
32
33
}
// namespace esphome::ethernet
34
35
#endif
// USE_ESP32 && USE_ETHERNET_W5500
defines.h
esphome::ethernet
Definition
ethernet_component.cpp:7
esphome::ethernet::install_w5500_async_spi
void install_w5500_async_spi(eth_w5500_config_t &config)
Definition
w5500_custom_spi.cpp:105
Generated by
1.12.0