WIZnet Developer Forum

Arduino Zero w/ W5500

Currently I have a W5500 shield that is working with an Arduino Uno to send and receive packets but I am running low on RAM so I am trying to use an Arduino Zero with the shield instead. The libraries provided by the Wiznet Github don’t seem to be compatiable with the Arduino Zero in terms of SPI interface. Any suggestions as a fix for my situation.

Arduino: 1.6.12 (Windows 8.1), Board: “Arduino/Genuino Zero (Programming Port)”

Build options changed, rebuilding all
C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp: In member function ‘void W5500Class::init()’:

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:29:19: error: no matching function for call to ‘SPIClass::begin(int)’

SPI.begin(SPI_CS);

               ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:29:19: note: candidate is:

In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:13:0,

             from C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:13:

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:110:8: note: void SPIClass::begin()

void begin();

    ^

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:110:8: note: candidate expects 0 arguments, 1 provided

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:34:32: error: no matching function for call to ‘SPIClass::setClockDivider(int, int)’

SPI.setClockDivider(SPI_CS, 2); // 42 Mhz, ok

                            ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:34:32: note: candidate is:

In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:13:0,

             from C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:13:

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:115:8: note: void SPIClass::setClockDivider(uint8_t)

void setClockDivider(uint8_t uc_div);

    ^

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:115:8: note: candidate expects 1 argument, 2 provided

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:35:36: error: no matching function for call to ‘SPIClass::setDataMode(int, int)’

SPI.setDataMode(SPI_CS, SPI_MODE0);

                                ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:35:36: note: candidate is:

In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:13:0,

             from C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:13:

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:114:8: note: void SPIClass::setDataMode(uint8_t)

void setDataMode(uint8_t uc_mode);

    ^

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:114:8: note: candidate expects 1 argument, 2 provided

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp: In static member function ‘static uint8_t W5500Class::write(uint16_t, uint8_t, uint8_t)’:

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:116:36: error: ‘SPI_CONTINUE’ was not declared in this scope

SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);

                                ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:119:29: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]

SPI.transfer(SPI_CS, _data);

                         ^

In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:13:0,

             from C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:13:

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:135:6: error: initializing argument 1 of ‘void SPIClass::transfer(void*, size_t)’ [-fpermissive]

void SPIClass::transfer(void *buf, size_t count)

  ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp: In static member function ‘static uint16_t W5500Class::write(uint16_t, uint8_t, const uint8_t*, uint16_t)’:

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:137:36: error: ‘SPI_CONTINUE’ was not declared in this scope

SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);

                                ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:143:30: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]

SPI.transfer(SPI_CS, _buf[i]);

                          ^

In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:13:0,

             from C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:13:

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:135:6: error: initializing argument 1 of ‘void SPIClass::transfer(void*, size_t)’ [-fpermissive]

void SPIClass::transfer(void *buf, size_t count)

  ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp: In static member function ‘static uint8_t W5500Class::read(uint16_t, uint8_t)’:

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:159:38: error: ‘SPI_CONTINUE’ was not declared in this scope

 SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);

                                  ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:162:43: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]

 uint8_t _data = SPI.transfer(SPI_CS, 0);

                                       ^

In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:13:0,

             from C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:13:

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:135:6: error: initializing argument 1 of ‘void SPIClass::transfer(void*, size_t)’ [-fpermissive]

void SPIClass::transfer(void *buf, size_t count)

  ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:162:43: error: void value not ignored as it ought to be

 uint8_t _data = SPI.transfer(SPI_CS, 0);

                                       ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp: In static member function ‘static uint16_t W5500Class::read(uint16_t, uint8_t, uint8_t*, uint16_t)’:

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:180:38: error: ‘SPI_CONTINUE’ was not declared in this scope

 SPI.transfer(SPI_CS, _addr >> 8, SPI_CONTINUE);

                                  ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:186:42: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]

 _buf[_len-1] = SPI.transfer(SPI_CS, 0);

                                      ^

In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5100.h:13:0,

             from C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:13:

C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI/SPI.h:135:6: error: initializing argument 1 of ‘void SPIClass::transfer(void*, size_t)’ [-fpermissive]

void SPIClass::transfer(void *buf, size_t count)

  ^

C:\Program Files (x86)\Arduino\libraries\Ethernet\src\utility\w5500.cpp:186:18: error: void value not ignored as it ought to be

 _buf[_len-1] = SPI.transfer(SPI_CS, 0);

              ^

exit status 1
Error compiling for board Arduino/Genuino Zero (Programming Port).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Found the solution to my problem. I just had to use the Ethernet2 library as it is compatible with the Arduino Zero but not Zero pro.

github.com/adafruit/Ethernet2.git

Hi Stephen,

How did you get the arduino zero work with the ethernet2 lib? I tried using that library but i got the error message “Failed to configure Ethernet using DHCP”.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.