The new ported library is 100% compatible with the old one and supports both W5100 and W5500 chips.
The library support the W5200 chip too but I haven’t ported it to STM32F1.
The W5500 chip is by far faster than the W5100 !
With the combination of STM32F103, VS1053 and W5500 I managed to play Internet streams (WebRadios) up to 192 kbps / 44000 Hz !
I hope with a source code optimization the bit-rate will be increased up to 320 kbps.
I have one more issue to solve before I publish it. When is used the Static IP the produced hex is almost 23 kB. When is used the DHCP client, the produced hex is almost 80 kB. 248% more flash space.
On Arduino nano (I know it’s 8-bit not 32-bit) the Static IP consumes ~10 kB and the DHCP ~13 kB. 30% more flash space.
The new ported library is 100% compatible with the old one and supports both W5100 and W5500 chips.
The library support the W5200 chip too but I haven’t ported it to STM32F1.
The W5500 chip is by far faster than the W5100 !
With the combination of STM32F103, VS1053 and W5500 I managed to play Internet streams (WebRadios) up to 192 kbps / 44000 Hz !
I hope with a source code optimization the bit-rate will be increased up to 320 kbps.
I have one more issue to solve before I publish it. When is used the Static IP the produced hex is almost 23 kB. When is used the DHCP client, the produced hex is almost 80 kB. 248% more flash space.
On Arduino nano (I know it’s 8-bit not 32-bit) the Static IP consumes ~10 kB and the DHCP ~13 kB. 30% more flash space.
I would compile one version, save that .map file somewhere else, then compile the other, and compare them, to see to what functions or ram structures that extra is going.
To choose between the W5100 or W5500 you have to edit the file Ethernet_STM\src\utility\w5100.h and comment-out the line of the chip you want to use.
The W5500 has been selected by default.
//#define W5100_ETHERNET_SHIELD // Arduino Ethenret Shield and Compatibles ...
//#define W5200_ETHERNET_SHIELD // WIZ820io, W5200 Ethernet Shield
#define W5500_ETHERNET_SHIELD // WIZ550io, ioShield series of WIZnet
I will give it a try in next few days on F4 and let you know if Flash consumption problem is there too.
I will give it a try in next few days on F4 and let you know if Flash consumption problem is there too.
I recall a thread several months ago, where someone complained that the sketch was large and it transpired that the compiler needed to bring in loads of additional classes to support one function.
I cant quite remember what Class it was, but it could have been something to do with strings.
But I’ve finally did it with F1, since by MapleMini was on a breadboard with free space for the module (My STM32F4Stamp breadboard was full).
Here are the result (of course, bigger than Vassilis compiles, since I have also many other lib in my Sketch_Buffet, such ad SD, MCP23017, etc) :
-rwxrwxr-x 1 martin martin 93648 Aug 19 19:04 MapleMini-Buffet-W5500Dhcp.bin*
-rwxrwxr-x 1 martin martin 38560 Aug 19 19:03 MapleMini-Buffet-W5500Static.bin*
-rwxrwxr-x 1 martin martin 101208 Aug 19 22:09 MapleMini-Buffet-UIPDhcp.bin*
-rwxrwxr-x 1 martin martin 46176 Aug 19 22:11 MapleMini-Buffet-UIPStatic.bin*
The problem is that the EthernetClass::begin() function using Dhcp is doing a “_dhcp = new DhcpClass()”, which bring the GCC memory management into the linkage. In embedded development, it is almost always bad to use “new” functions.
So, I don’t if it is the best way to handle/workaround the bug, I’ve simply declared a DhcpClass globally and static in Ethernet_STM.cpp, and initialize the _dhcp member with its pointer.
So, resulting binary size is now reasonable :
-rwxrwxr-x 1 martin martin 43512 Aug 20 19:13 /tmp/build889919623780855637.tmp/MapleMini-Buffet.cpp.bin
Finally I solve it.
Compiling with static gave me:
Sketch uses 20,476 bytes (15%) of program storage space. Maximum is 131,072 bytes.
Only 2% delta. I do not even have a need for the class, but may use it simply because it is so efficient!
Seriously, great job… hope your tests are all successful.
Ray
The new library is ready. The old Ethernet_STM library supports only the W5100 chip and it has been published to my GitHub. From there, the Roger was created a link to his repository.
The new library supports both W5100 and W5500 chips. I have made the necessary modifications for supporting the W5200 too, but I don’t have a W5200 Ethernet module to test it.
Should I replace the old “Ethernet_STM” library files on my GitHub with the new “Ethernet_STM” library files (keep the same library name) or should I create a new repository for example Ethernet2_STM ?
Should I replace the old “Ethernet_STM” library files on my GitHub with the new “Ethernet_STM” library files (keep the same library name) or should I create a new repository for example Ethernet2_STM ?
I don’t think keep the old one is worth, since the new lib is also working with W5100, except if you know something that we don’t know. ![]()
That is bringing me the question, question not only for you : is the Serasidis_EtherCard_STM still useful ? If not, maybe Roger need to delete too …
The DHCP problem was on the “_dhcp = new DhcpClass()” as already told Martin (thanks man!). Sadly, the Martins solution didn’t work for me.
So, what I did was to create a new DhcpClass object globally named _dhcp into the Ethernet_STM.cpp file and the structure dereference lines containing “_dhcp->” replace by “_dhcp.”
For example the line
W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
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?
//#define WIZ550io_WITH_MACADDRESS // Use assigned MAC address of WIZ550ioI finally know why I can’t get it. Just comment line 45 in file w5500.cpp :
write(0x00, 0x05, 128); // Software reset the W5500 chip
Will this library work with BLACK Board STM32F407VET6 ?
a lot of errors.If I use my library a lot of errors
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
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.
[libmaple] Black F407VET6 ( https://github.com/stevstrong/Arduino_STM32)
This lib is working for F1 family due to:
#if defined(__STM32F1__)And I will remove all non-STM32 references to avoid further issues.
I am very grateful for YOUR work !
You do so much for everyone !
THANK you !!!
https://github.com/stevstrong/Ethernet_STM32
The main changes:
– in only works on W5500-based boards, any other derivative target has been removed
– it only supports STM32F1 and F4, any other reference to AVR or other targets has been removed
– there is no need to edit any header file for setup, the SPI object and the chip select pin is passed by using an additional function:
Ethernet.init([spi_object], [chip_select_pin]);
SUPER !
I’M REALLY WAITING FOR THIS !
Could you tell me what pins you need and where to connect, I will check !
https://ru.aliexpress.com/item/Free-shi … 0.0.H5Ls9p
Thank YOU very much for your work !
You need to connect the appropriate SPI pins (of which ever SPI port you want), the chip select and power supply 5V + GND.
The 3.3V, INT and RST pins are not used.
I like the way anyone can choose the SPI port and CS pin.
Well done !
Thanks for all your hard work porting this library. I have a query.
I want to use a number of STM32duinos to send sensor information to a PC. The PC will request this information and I want to be able to assign the IP address to each module myself rather than it possibly having a different address each time the power has been off etc. I am just starting and this is the code I have so far.
#include <Ethernet_STM32.h>
#include <SPI.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 16, 1);
//EthernetClient client;
SPIClass mSpi(2);
void setup()
{
Serial.begin(115200);
delay(3000);
Ethernet.init(mSpi, PB12);
Ethernet.begin(mac, ip);
Serial.print(" IP Address assigned ");
Serial.println(Ethernet.localIP());
}
void loop()
{
}
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
[efftek – Mon Aug 27, 2018 11:43 am] –
Now, it reports that this IP address ( 192.168.16.1) has been assigned but I can’t ping it. Ive also tried several other addresses.
The router will not accept a fix IP allocation if DHCP is activated, that is why you cannot ping it from other net client.
A static IP address is only accessible if the DHCP is deactivated on the router. In this case you need all net components to have static IP addresses allocated.
If I use DHCP to dynamically allocate the IP addresses, when a bluepill module (server) comes online, it can contact the client to anounce itself, give its serial number which can identify who it is and its latest IP address. The client will look up the serial number in its database and change the IP address stored for it so it knows how to contact it to request data. That seems straightforward and sensible. But how does the server know what the clients IP address is if it isnt static?
So can I give the PC client a fixed IP address and still use DHCP to allocate the server’s individual addresses?
This networking stuff is all new to me and Im confused. Thanks for your guidance.
Steve F.
In case both the server and the client are attached to a DHCP router, they both will get IP addresses allocated.
You have to find out the server address and hard code it in the client application, so the client has to know the server address. The server will find out the client address when the client issues a request to the server.
Next problem.
I have the STM32 working with the W5500 board. I create the MAC address from the STM32’s ID no and the DCHP sets the IP address. My PC can send a request and the STM32 reply. I now need to get the SD card working – the volume of data I need to collect from the ADC at 10,000 sps has to be written to SD card and then sent onwards by Ethernet.
The W5500 is on SPI2 and the SD card, SPI1 – Id be happy to put the SD card on SPI2 also if I knew how to change the SD settings.
This code initialises the W5500
#include <Ethernet_STM32.h>
#include <SPI.h>
#include <SD.h>
Sd2Card card;
SdVolume volume;
SdFile root;
const int chipSelect = 4;
byte *id5 = (byte *) (0x1FFFF7EC);
byte *id4 = (byte *) (0x1FFFF7EC+0x01);
byte *id3 = (byte *) (0x1FFFF7EC+0x02);
byte *id2 = (byte *) (0x1FFFF7EC+0x03);
byte *id1 = (byte *) (0x1FFFF7EC+0x04);
byte mac[] = { 0xEA, *id1, *id2, *id3, *id4, *id5 };
unsigned int localPort = 8000;
EthernetServer server(localPort);
SPIClass mSpi(2); //USING SPI2 PB12-PB15
void setup()
{
Serial.begin(115200);
delay(3000);
Ethernet.init(mSpi, PB12);
Ethernet.begin(mac);
Serial.print("IP Address assigned ");
Serial.println(Ethernet.localIP());
server.begin();
}
1. change the order of SD card init and Ethernet init
2. leave this order, and before card.init() call:
SPI.setModule(1);
I will try this in the morning. I’ll keep you posted.
A bit of experimenting (without the W5500 card connected) and I find I can simply use
SPI.setModule(2);
card.init(SPI_HALF_SPEED, 8));
SPI.beginTransaction(SPISettings(<speed_in_Hz>, [other_params])); // only speed is mandatory, the rest is optionalI wish I knew half as much about this topic as you do, but then you’d still know twice as much as me!
This is my code for starting conncting my BluePill to the ethernet
void StartEther()
{
SPI.setModule(1);
Ethernet.init(PA4);
if(Ethernet.begin(mac))
{
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
else
Serial.println("Server FAIL");
}
An ARP cache is a simple mapping of IP addresses to MAC addresses. Each time a computer’s TCP/IP stack uses ARP to determine the Media Access Control (MAC) address for an IP address, it records the mapping in the ARP cache so that future ARP lookups go faster.
Afaik, as long as you do not access the new IP address, the cache cannot know it, since it works only from “cache”.
[stevestrong – Tue Sep 18, 2018 6:34 am] –
Afaik, as long as you do not access the new IP address, the cache cannot know it, since it works only from “cache”.
Thanks again, that would explain how the IP address is in the arp list after I ping it and not before. So, is there a way I access the IP address from the BluePill after the server.begin() command once it know’s its own address? Can I set it up as a client first then become a server?
Cheers, Steve
Thus you know its IP address.
OTOH, this is what I have found on the net:
https://www.iplocation.net/find-private-network-ip:
How do I find the IP address of all devices on my network?
Ping your network using a broadcast address, i.e. “ping 192.168.1.255”. After that, perform “arp -a” to determine all the computing devices connected to the network. 3. You may also use “netstat -r” command to find an IP address of all network routes.
I will be installing 20 modules at various locations on a plant on their own network using PoE. Each module has its own mac based on the STM32’s unique ID so I know which mac I have installed where and I can assign them on the Client PC to units on a database but first they need to appear in the arp table so the client PC can see them and their IP addresses.
I have managed to get the modules to appear in the arp table straight away. This is how I did it. I set my client PC to a static IP address 192.168.2.14 (the one it happened to be at the time) and declared;
IPAddress ip(192, 168, 2, 14);
EthernetServer server(6000);
EthernetClient arp;




All Comments