From 2d52586daad70276761c6be3acee2b7ad4e42d7d Mon Sep 17 00:00:00 2001 From: GiungKim Date: Wed, 19 Jan 2022 14:55:44 +0900 Subject: [PATCH] Modify ethernet chip version check function --- libraries/CMakeLists.txt | 4 ++-- port/ioLibrary_Driver/w5x00_spi.c | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index b57d929..4c5c9f0 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -3,7 +3,7 @@ add_library(ETHERNET_FILES STATIC) target_sources(ETHERNET_FILES PUBLIC ${WIZNET_DIR}/Ethernet/socket.c - ${WIZNET_DIR}/Ethernet/wizchip_conf.c + ${WIZNET_DIR}/Ethernet/wizchip_conf.c ) target_include_directories(ETHERNET_FILES INTERFACE @@ -198,7 +198,7 @@ target_sources(MQTT_FILES PUBLIC target_include_directories(MQTT_FILES PUBLIC ${WIZNET_DIR}/Ethernet ${WIZNET_DIR}/Internet/MQTT - ${WIZNET_DIR}/Internet/MQTTPacket/src + ${WIZNET_DIR}/Internet/MQTTPacket/src ) # SNTP 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 */