From 4621ffd5604510784cb81bcd61c4d8ccdbec42a0 Mon Sep 17 00:00:00 2001 From: GiungKim Date: Wed, 19 Jan 2022 15:18:06 +0900 Subject: [PATCH] Modify ethernet chip version check function --- port/ioLibrary_Driver/w5x00_spi.c | 15 +++++++++++++-- port/ioLibrary_Driver/w5x00_spi.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/port/ioLibrary_Driver/w5x00_spi.c b/port/ioLibrary_Driver/w5x00_spi.c index 17b400f..0e57395 100644 --- a/port/ioLibrary_Driver/w5x00_spi.c +++ b/port/ioLibrary_Driver/w5x00_spi.c @@ -217,14 +217,25 @@ void wizchip_initialize(void) void wizchip_check(void) { +#if (_WIZCHIP_ == W5100S) /* Read version register */ - if (getVER() != 0x51) // W5100S + if (getVER() != 0x51) { - printf(" ACCESS ERR : VERSIONR != 0x51, read value = 0x%02x\n", getVER()); + printf(" ACCESS ERR : VERSION != 0x51, read value = 0x%02x\n", getVER()); while (1) ; } +#elif (_WIZCHIP_ == W5500) + /* Read version register */ + if (getVERSIONR() != 0x04) + { + printf(" ACCESS ERR : VERSION != 0x04, read value = 0x%02x\n", getVERSIONR()); + + while (1) + ; + } +#endif } /* Network */ diff --git a/port/ioLibrary_Driver/w5x00_spi.h b/port/ioLibrary_Driver/w5x00_spi.h index b246724..2b2e447 100644 --- a/port/ioLibrary_Driver/w5x00_spi.h +++ b/port/ioLibrary_Driver/w5x00_spi.h @@ -70,6 +70,7 @@ static uint8_t wizchip_read(void); * \param tx_data Buffer of data to write */ static void wizchip_write(uint8_t tx_data); + #ifdef USE_SPI_DMA /*! \brief Configure all DMA parameters and optionally start transfer * \ingroup w5x00_spi