I've got an Arduino 328 interfaced with a WIZ811MJ (uses W5100) set to 192.168.12.81. By itself it replies very consistently to pings. If I power up a second identical prototype with IP 192.168.12.82, I only get ping replies from one of them at a time. For example, 192.168.12.81 will reply for ~20 secs while 192.168.12.82 times out, then 12.82 will reply for ~20 secs while 12.81 times out. They alternate like that, the 20s isn't constant, sometimes shorter. Any ideas? If you need to see my code, just let me know. I'm using the Ethernet library.
Yes, but now I realize that I am assigning the same MAC to both modules. Now how do I go about assigning MACs that aren't going to conflict with anything else on my network.
Now how do I go about assigning MACs that aren't going to conflict with anything else on my network.
Are you using an Arduino Ethernet shield? If so, it should come with a MAC address sticker.
The likelihood of some randomly chosen 12 hex digits matching another device address, in order seems pretty low to me. If you do encounter a conflict, can you pick some lottery numbers for me?
PaulS:
Are you using an Arduino Ethernet shield? If so, it should come with a MAC address sticker.
The likelihood of some randomly chosen 12 hex digits matching another device address, in order seems pretty low to me. If you do encounter a conflict, can you pick some lottery numbers for me?
I'm using WIZ811MJ boards and I don't see MAC addresses on them. I downloaded this. Nicely shows IP, MAC, host name & vendor (possibly interpolated from MAC).
I once had a conflict between two WRT54G routers (running dd-wrt of course) where IIRC the one router's LAN MAC conflicted with the other's WLAN.
I've started storing a unique MAC and IP address in my Arduino's EEPROM. I just used the example code with a couple modifications:
#include <EEPROM.h>
byte MAC[6] = {
0xaa, 0, 0, 0, 0, 0x01};
byte IP[4] = {
10,0,1, 150 };
void setup()
{
// write the value to the appropriate byte of the EEPROM.
// these values will remain there when the board is
// turned off. 328s have 1024 bytes of EEPROM
int addr = 0x3f0;
for (int i = 0; i < 6; i++) {
EEPROM.write(addr, MAC[i]);
addr++;
}
addr = 0x3f6;
for (int i = 0; i < 4; i++) {
EEPROM.write(addr, IP[i]);
addr++;
}
}
void loop()
{}
Also, if you want to generate your own locally administered MAC address, the rule is to set the second least significant bit of the first octet of your address.
EmilyJane:
Also, if you want to generate your own locally administered MAC address, the rule is to set the second least significant bit of the first octet of your address.
Can you please elaborate on that? Two example MAC addresses should do it.
Do you mean increment the second least significant bit of the first octet only? Or set it to my own value and then increment the last octet or something like that?
Sure. x2:xx:xx:xx:xx:xx and xA:xx:xx:xx:xx:xx for example.
Set, (to 1), the second least significant bit of the first octet. The rest of the bits are immaterial. If that bit is 1, the MAC address is considered locally administered.
EmilyJane:
Sure. x2:xx:xx:xx:xx:xx and xA:xx:xx:xx:xx:xx for example.
Set, (to 1), the second least significant bit of the first octet. The rest of the bits are immaterial. If that bit is 1, the MAC address is considered locally administered.
Thanks for taking the time to explain it. I also did some RTFM'ing of my own, I think I understand.
Another way to look at it is if you consider that at the physical layer, the MAC address is transmitted left to right with each octet transmitted LSB first, then the second bit "on the wire" is a "1" for locally administered addresses. If you observe that rule when you create your own, then no piece of commercial hardware that you install on your network can have a conflicting MAC address.
// write the value to the appropriate byte of the EEPROM.
// these values will remain there when the board is
// turned off. 328s have 1024 bytes of EEPROM
int addr = 0x3f0;
for (int i = 0; i < 6; i++) {
EEPROM.write(addr, MAC[i]);
addr++;
}
addr = 0x3f6;
for (int i = 0; i < 4; i++) {
EEPROM.write(addr, IP[i]);
addr++;
}
}
void loop()
{}
I like this idea, is there a reason you start at 0x3f0 (byte 1007) instead of 0x3f6 (1014)? I'm thinking the MAC needs 6 bytes, IP needs 4.
I like this idea, is there a reason you start at 0x3f0 (byte 1007) instead of 0x3f6 (1014)? I'm thinking the MAC needs 6 bytes, IP needs 4.
Only that I wanted to leave a little room in case I decide to save the port number and some as yet un-thought of values. I've been thinking about moving the data to the start of EEPROM in order to make it compatible with some '168s I still have.
I have a situation here where I can't ping or access my arduino/w5100 with a MAC of 01:01:01:01:01:01 over my WDS link. Is that because I'm not following the "locally administered" convention?
That would be the simplest way to answer your question. I suspect the problem is something else though. WDS can be tricky to set up. Can you ping anything else on the other network?
Well I tried 02:19:21:68:ab:cd and 192.168.ab.cd. Seems to be working. I have not really tried to duplicate my seemingly WDS incompatible MAC woes but I was having trouble with my new wireless N WDS link. Now I'm back to the ol' G link.