Skip to content

Commit 3eaa825

Browse files
committed
Fix SPI for DM9051
1 parent c613d69 commit 3eaa825

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: libraries/Ethernet/src/ETH.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ esp_err_t ETHClass::eth_spi_read(uint32_t cmd, uint32_t addr, void *data, uint32
258258

259259
#if CONFIG_ETH_SPI_ETHERNET_DM9051
260260
if(_phy_type == ETH_PHY_DM9051){
261-
_spi->write(cmd);
262-
_spi->write(addr);
261+
_spi->write(((cmd & 0x01) << 7) | (addr & 0x7F));
263262
} else
264263
#endif
265264
#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,
300299

301300
#if CONFIG_ETH_SPI_ETHERNET_DM9051
302301
if(_phy_type == ETH_PHY_DM9051){
303-
_spi->write(cmd);
304-
_spi->write(addr);
302+
_spi->write(((cmd & 0x01) << 7) | (addr & 0x7F));
305303
} else
306304
#endif
307305
#if CONFIG_ETH_SPI_ETHERNET_W5500

0 commit comments

Comments
 (0)