Hi guys,
I stumbled into this problem a days ago, and I think I came up with some solution (or so I think).
Before I came up with a solution, I read this thread: WIZ550io schematic and PIC memory for MAC Address - #4 by Edward - WIZ550io - WIZnet Developer Forum
So the conclusion is if you use software reset, the MAC Address value (and the other like IP, DNS, Gateway, etc) on the Common Register W5500 became zero. I peek into the Ethernet library and found out everytime we init the Wiznet module, we do software reset. You can find it on w5500.cpp:
void W5500Class::init(uint8_t ss_pin)
{
SPI_CS = ss_pin;
delay(1000);
initSS();
SPI.begin();
w5500.swReset(); //<-- Software reset
for (int i=0; i<MAX_SOCK_NUM; i++) {
uint8_t cntl_byte = (0x0C + (i<<5));
write( 0x1E, cntl_byte, 2); //0x1E - Sn_RXBUF_SIZE
write( 0x1F, cntl_byte, 2); //0x1F - Sn_TXBUF_SIZE
}
}
So what I do is comment the //W5500.swReset();, and voila, I can read the MAC Address. Here is the code to read MAC Address in case you need it. Don`t forget to uncomment #define WIZ550io_WITH_MACADDRESS on file Ethernet2.h first.
#include <SPI.h>
#include <Ethernet2.h>
IPAddress ip(192, 168, 202, 133);
EthernetServer server(80);
void setup() {
Serial.begin(9600);
Ethernet.begin(ip);
server.begin();
byte mac_address[6] ={0,};
w5500.getMACAddress(mac_address);
for(int i = 0; i < 6; i++) {
Serial.write(mac_address[i]);
}
}
void loop() {
}
But please be aware if your Wiznet module is already flashed by software reset, you need to rewrite the MAC Address using Ethernet.begin(mac) (and it goes without saying, please comment #define WIZ550io_WITH_MACADDRESS on file Ethernet2.h before do Ethernet.begin(mac)).
But this solution came up with anoher question: Why we need to do software reset after all? I have comment it and still haven`t find any problem till today. If you know, please kindly share it here.
Sorry for my bad english. Hope it helps guys.