vrutha
April 3, 2020, 9:28am
1
Hi, in my ethernet code am getting error in writeMR function whixh is always returning zero.
uint8_t W5100Class::isW5200(void)
{
uint8_t mr;
chip = 52;
Serial.println("w5100.cpp: detect W5200 chip");
if (!softReset()) return 0;
writeMR(0x08);
if (readMR() != 0x08) return 0;
writeMR(0x10);
if (readMR() != 0x10) return 0;
writeMR(0x00);
if (readMR() != 0x00) return 0;
int ver = readVERSIONR_W5200();
//Serial.print ("version=");
//Serial.println (ver);
if (ver != 3) return 0;
Serial.println("chip is W5200");
return 1;
}
Robin2
April 3, 2020, 10:04am
2
You need to post a link to the library that contains the writeMR() function.
Also, post a complete program, snippets are no use for debugging.
And when posting code please use the code button </>
so your code
looks like this
and is easy to copy to a text editor See How to use the forum
...R
This code is from utility/w5100.cpp in the Ethernet library.
It would be nice to know what is the error you are getting in your code.
A wild guess: your connections between your board and your Ethernet module/shield are not made properly - can you check these?