From 3eaa825524b6556b5bfedcd6847ac158e5b7cc70 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Wed, 6 Sep 2023 12:54:10 +0300 Subject: [PATCH] Fix SPI for DM9051 --- libraries/Ethernet/src/ETH.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index 93ca4cf1cfe..ebc499f7857 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -258,8 +258,7 @@ esp_err_t ETHClass::eth_spi_read(uint32_t cmd, uint32_t addr, void *data, uint32 #if CONFIG_ETH_SPI_ETHERNET_DM9051 if(_phy_type == ETH_PHY_DM9051){ - _spi->write(cmd); - _spi->write(addr); + _spi->write(((cmd & 0x01) << 7) | (addr & 0x7F)); } else #endif #if CONFIG_ETH_SPI_ETHERNET_W5500 @@ -300,8 +299,7 @@ esp_err_t ETHClass::eth_spi_write(uint32_t cmd, uint32_t addr, const void *data, #if CONFIG_ETH_SPI_ETHERNET_DM9051 if(_phy_type == ETH_PHY_DM9051){ - _spi->write(cmd); - _spi->write(addr); + _spi->write(((cmd & 0x01) << 7) | (addr & 0x7F)); } else #endif #if CONFIG_ETH_SPI_ETHERNET_W5500