W5500 library is (finally) ported

Please do not post requests
yaqubap
Posts: 3
Joined: Wed Jan 20, 2016 8:06 am

Re: W5500 library is (finally) ported

Post by yaqubap » Thu Feb 18, 2016 8:44 am

Anyone use WIZ550io?

WIZ550io has PIC for store IP and MAC address. I use Serasidis STM32duino library. I got NULL when I am trying to get the MAC Address.

I have set the MAC address, but it was not stored to PIC (I always get NULL after WIZ550io rebooted). Anyone can help me?

User avatar
Vassilis
Posts: 336
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Re: W5500 library is (finally) ported

Post by Vassilis » Thu Feb 18, 2016 12:09 pm

Edit the Ethernet_STM/src/utility/w5100.h file and comment out (enable) the line 22 by removing the double slash

Code: Select all

//#define WIZ550io_WITH_MACADDRESS // Use assigned MAC address of WIZ550io
Then, re-compile your sketch.

yaqubap
Posts: 3
Joined: Wed Jan 20, 2016 8:06 am

Re: W5500 library is (finally) ported

Post by yaqubap » Fri Feb 19, 2016 7:42 am

I have commented out that line, but I still can't get the MAC address.

I finally know why I can't get it. Just comment line 45 in file w5500.cpp :

Code: Select all

write(0x00, 0x05, 128); // Software reset the W5500 chip
Then my problem solved.
Thanks.

acronis
Posts: 161
Joined: Thu Mar 02, 2017 12:32 pm

Re: W5500 library is (finally) ported

Post by acronis » Tue Jul 11, 2017 8:44 am

Hello.
Will this library work with BLACK Board STM32F407VET6 ?

stevestrong
Posts: 2070
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: W5500 library is (finally) ported

Post by stevestrong » Tue Jul 11, 2017 8:50 am

Just try it (pay attention to the correct SPI port selection, the F4 board has 3 SPI ports), and post here if something does not work.

acronis
Posts: 161
Joined: Thu Mar 02, 2017 12:32 pm

Re: W5500 library is (finally) ported

Post by acronis » Tue Jul 11, 2017 9:01 am

I use my library #include <Ethernet_STM.h>
a lot of errors.If I use my library a lot of errors







Code: Select all

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dhcp.cpp: In member function 'uint8_t DhcpClass::parseDHCPResponse(long unsigned int, uint32_t&)':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dhcp.cpp:332:55: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

                     if( *((uint32_t*)_dhcpDhcpServerIp) == 0 || 

                                                       ^

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:7:0:

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp: In member function 'uint16_t DNSClient::ProcessResponse(uint16_t, IPAddress&)':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:285:58: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

     uint16_t header_flags = htons(*((uint16_t*)&header[2]));

                                                          ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility/util.h:4:22: note: in definition of macro 'htons'

 #define htons(x) ( ((x)<< 8 & 0xFF00) | \

                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:285:58: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

     uint16_t header_flags = htons(*((uint16_t*)&header[2]));

                                                          ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility/util.h:5:22: note: in definition of macro 'htons'

                    ((x)>> 8 & 0x00FF) )

                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:287:50: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

     if ( ( iRequestId != (*((uint16_t*)&header[0])) ) ||

                                                  ^

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:7:0:

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:304:57: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

     uint16_t answerCount = htons(*((uint16_t*)&header[6]));

                                                         ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility/util.h:4:22: note: in definition of macro 'htons'

 #define htons(x) ( ((x)<< 8 & 0xFF00) | \

                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:304:57: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

     uint16_t answerCount = htons(*((uint16_t*)&header[6]));

                                                         ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility/util.h:5:22: note: in definition of macro 'htons'

                    ((x)>> 8 & 0x00FF) )

                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:313:58: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

     for (uint16_t i =0; i < htons(*((uint16_t*)&header[4])); i++)

                                                          ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility/util.h:4:22: note: in definition of macro 'htons'

 #define htons(x) ( ((x)<< 8 & 0xFF00) | \

                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\Dns.cpp:313:58: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

     for (uint16_t i =0; i < htons(*((uint16_t*)&header[4])); i++)

                                                          ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility/util.h:5:22: note: in definition of macro 'htons'

                    ((x)>> 8 & 0x00FF) )

                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\socket.cpp: In function 'uint16_t igmpsend(SOCKET, const uint8_t*, uint16_t)':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\socket.cpp:322:11: warning: variable 'status' set but not used [-Wunused-but-set-variable]

   uint8_t status=0;

           ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp: In member function 'void W5500Class::init()':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:37:19: error: no matching function for call to 'SPIClass::begin(int)'

   SPI.begin(SPI_CS);

                   ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:37:19: note: candidate is:

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src/utility/w5100.h:13:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:13:

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:170:10: note: void SPIClass::begin()

     void begin(void);

          ^

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:170:10: note:   candidate expects 0 arguments, 1 provided

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:42:32: error: no matching function for call to 'SPIClass::setClockDivider(int, int)'

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

                                ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:42:32: note: candidate is:

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src/utility/w5100.h:13:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:13:

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:198:7: note: void SPIClass::setClockDivider(uint32_t)

  void setClockDivider(uint32_t clockDivider);

       ^

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:198:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:43:36: error: no matching function for call to 'SPIClass::setDataMode(int, spi_mode)'

   SPI.setDataMode(SPI_CS, SPI_MODE0);

                                    ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:43:36: note: candidate is:

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src/utility/w5100.h:13:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:13:

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:200:7: note: void SPIClass::setDataMode(uint8_t)

  void setDataMode(uint8_t dataMode);  

       ^

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:200:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp: In static member function 'static uint8_t W5500Class::write(uint16_t, uint8_t, uint8_t)':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:132:36: error: 'SPI_CONTINUE' was not declared in this scope

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

                                    ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:135:29: error: no matching function for call to 'SPIClass::transfer(int, uint8_t&)'

   SPI.transfer(SPI_CS, _data);

                             ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:135:29: note: candidate is:

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src/utility/w5100.h:13:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:13:

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note: uint8 SPIClass::transfer(uint8) const

     uint8 transfer(uint8 data) const;

           ^

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note:   candidate expects 1 argument, 2 provided

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp: In static member function 'static uint16_t W5500Class::write(uint16_t, uint8_t, const uint8_t*, uint16_t)':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:162:36: error: 'SPI_CONTINUE' was not declared in this scope

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

                                    ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:168:30: error: no matching function for call to 'SPIClass::transfer(int, const uint8_t&)'

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

                              ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:168:30: note: candidate is:

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src/utility/w5100.h:13:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:13:

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note: uint8 SPIClass::transfer(uint8) const

     uint8 transfer(uint8 data) const;

           ^

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note:   candidate expects 1 argument, 2 provided

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp: In static member function 'static uint8_t W5500Class::read(uint16_t, uint8_t)':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:191:38: error: 'SPI_CONTINUE' was not declared in this scope

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

                                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:194:43: error: no matching function for call to 'SPIClass::transfer(int, int)'

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

                                           ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:194:43: note: candidate is:

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src/utility/w5100.h:13:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:13:

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note: uint8 SPIClass::transfer(uint8) const

     uint8 transfer(uint8 data) const;

           ^

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note:   candidate expects 1 argument, 2 provided

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp: In static member function 'static uint16_t W5500Class::read(uint16_t, uint8_t, uint8_t*, uint16_t)':

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:221:38: error: 'SPI_CONTINUE' was not declared in this scope

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

                                      ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:227:42: error: no matching function for call to 'SPIClass::transfer(int, int)'

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

                                          ^

C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:227:42: note: candidate is:

In file included from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src/utility/w5100.h:13:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Ethernet_STM-master\src\utility\w5500.cpp:13:

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note: uint8 SPIClass::transfer(uint8) const

     uint8 transfer(uint8 data) const;

           ^

C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src/SPI.h:261:11: note:   candidate expects 1 argument, 2 provided

Last edited by acronis on Mon Jul 17, 2017 12:57 pm, edited 1 time in total.

User avatar
zoomx
Posts: 567
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: W5500 library is (finally) ported

Post by zoomx » Tue Jul 11, 2017 9:21 am

acronis,
please provide
Which board are you using?
Which core are you using?

I loaded the Telnet example and it compiles withouth errors. Try using an example.

acronis
Posts: 161
Joined: Thu Mar 02, 2017 12:32 pm

Re: W5500 library is (finally) ported

Post by acronis » Tue Jul 11, 2017 9:28 am

BLACK Board STM32F407VET6
[libmaple] Black F407VET6 ( https://github.com/stevstrong/Arduino_STM32)

stevestrong
Posts: 2070
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: W5500 library is (finally) ported

Post by stevestrong » Tue Jul 11, 2017 9:42 am

The problem is that this lib still has some defines for non-STM32 devices.
This lib is working for F1 family due to:

Code: Select all

#if defined(__STM32F1__)
all over the code.

The solution for F4 is to replace these lines by:

Code: Select all

#if defined(__STM32F1__) || defined (__STM32F4__)
For example, this line: https://github.com/rogerclarkmelbourne/ ... 0.cpp#L124
should be replaced by:

Code: Select all

#elif defined(__STM32F1__) || defined (__STM32F4__)
otherwise the compiler takes code which is not designed for STM32.

The cleanest solution would be to remove all non-STM32 references from this lib, as its name already states that it should be adapted for STM32 only.

stevestrong
Posts: 2070
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: W5500 library is (finally) ported

Post by stevestrong » Wed Jul 12, 2017 8:32 am

I will rework this library because it has many things which are not configurable but which should be, for instance the SPI class object (currently is fix coded).
And I will remove all non-STM32 references to avoid further issues.

Post Reply