MAC Address issues
-
"Also, there's no reason that BE:EF:DE:AD:FE:EE would be an invalid MAC address, but they may have objections to using a human-chosen MAC."
The confusion is the extra characters because P0xBE:0xEF:0xDE:0xAD:0xFE:0xEE does not equal BE:EF:DE:AD:FE:EE to the average person, unless you know to decode it that way. It does not state this in the documentation in a clear way. Most people may not know that. I had a feeling it was something like this, but no way to read and verify that I found so far.... I never gave MAC addresses a second thought until today, so I would not have known that.
The documentation is not totally clear on this, but now it makes more sense after this conversation.
From the manual:
M540: Set MAC address
ParametersPnnn The MAC address
ExamplesM540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xED
M540 PDE:AD:BE:EF:CA:FE
Sets the http://en.wikipedia.org/wiki/MAC_address of the printer. This should be done before any other network commands. The MAC address is six one-byte hexadecimal numbers separated by colons. The 0x prefix is optional.All devices running on the same network shall all have different MAC addresses. For your printers, changing the last digit is sufficient.
Note on the Duet 2 Wifi the MAC address is unique and set on the Wifi Module so this command has no effect. The default MAC address on a Duet 2 Ethernet is generated from the unique processor ID so there is normally no need to change it.
So if I want to enter my own MAC address of lets say 3B:C5:14:FA:21:8C for example. I believe I would enter:
M540 P0x3B:0xC5:0x14:0xFA:0x21:0x8C
or
M540 P3B:C5:14:FA:21:8CWould these end up the same MAC address of 3B:C5:14:FA:21:8C ?
-
@bot said in MAC Address issues:
Even better, simply remove the gcode to set the MAC address, as the ethernet version of the Duet 2 will generate a unique MAC address based on the MCU serial number, in the absence of a user-set MAC address.
I will experiment and try this. This seems like a good way if it works.
-
I commented out the M540 MAC address line in the config.g
However, now, how would I tell what unique MAC address it assigned? How can I retrieve it? -
@jevs that is a good question. If you can connect it to a router that you have access to, you should be able to deduce which Mac/ip combo is the duet.
Paneldue will display then IP in console if it connects, if you have a paneldue. I wonder if sending the gcode for MAC address without any parameters would return the Mac.
-
M540 does return a MAC address.
-
I just saw your post about the formatting. It surprised me too at first, as I'm not a programmer. Apparently it's a conventional way of denoting hexadecimal numbers.
https://stackoverflow.com/questions/8186965/what-do-numbers-using-0x-notation-mean/30659292
-
You also cannot just randomly change digits. I put in "II" as the last two. Those are I's as in "eye"
This did not change the last digits to ":II". It actually messed up the whole MAC addess.So, what I did was go to a random MAC address generator. Set the prefix to "be" like what the duet has in the default and then generated a made up MAC address.
For example if I generate a random MAC address specifying "be" as the prefix and the generator gives me be:dd:e0:d3:31:62, i would then enter this line in the config.g:
M540 P0xbe:0xdd:0xe0:0xd3:0x31:0x62
Once it saves the config.g and reboots, you can run "M540" from the G code command line and it will report the MAC as be:dd:e0:d3:31:62
So, as of now we have a static IP on the system assigned and the MAC address is showing up normal and just as I set it.
Success......finally. The documentation certainly needs some clarification on this one in my opinion.
-
Haha... this comes back to those pesky "0x" prefixes. The two digits that follow 0x are hexadecimal numbers. You were a few letters off of the highest digit in hexadecimal.
0 1 2 3 4 5 6 7 8 9 A B C D E F
That's like counting to 15 in hexadecimal.
-
Yeah. A little more in depth info on the M540 section of the instruction set could be beneficial, but it all makes sense to me now.
Adding that entering "M540" by itself will report the MAC address would be great since it does work. This can be used to test that you are getting what you intended without going on the network and trying to find out if it is there, especially in a scenario where you do not have any control or access to the network controls.
-
@jevs said in MAC Address issues:
Adding that entering "M540" by itself will report the MAC address would be great since it does work.
This is true of any gcode that is used to set values. Sending it without values will return the currently set values. I'll add a note about that to the gcode wiki though.