Did you know... the M340's Default Addresses
The first time you connect to a PLC just shipped from the factory can be frustrating experience. Firmware may need to be updated, special cables exhumed from their dusty crypts, or automatic IP addressed assigned from DHCP servers tracked down.
Recognizing these issues, Schneider-Electric has come up with a useful solution. Did you know that every M340 with a builtin Ethernet port, comes with a default IP address? Better yet, rather than giving each M340 the same IP address, constituting a security risk from every integrator too lazy to change the default conditions of the PLC, each M340 is guaranteed to have a unique IP address.
So how do you find this unique address? It's written right on the front of the device. Here's a picture I took of an M340's default IP Address.
Not seeing it? That's okay, there's a trick to it. Schneider-Electric "hid" the IP address within the Physical address (the MAC address).
But first, a little explanation of what a MAC address is. The MAC address is the actual identifier used to communicate between two pieces of equipment. Whenever you ping an IP address, such as 192.168.1.1, your local computer has to ask for the physical address that is associated with that IP address, once it knows then communications can begin (this is a gross oversimplification, but sufficient for this topic). As a result, every physical, or MAC, address must be unique!
To ensure that it is unique, each manufacturer is given their own identifying number, this number is represented by the first three "octets" of the MAC address, 00-80-F4 in the photo above, and is called the "Manufacturer ID." Then each manufacturer assigns a unique number to the actual device using the last three octets, called the "Device ID". Rather than using the decimal system, which would limit each octet to a two digit number between 0 and 99, the numbers are written in Hexadecimal and can represent a number between 0 and 254. The end result is every manufacturer can create 255x255x255 (16,581,375) unique MAC addresses before having to create a duplicated address, or getting an additional Manufacturer ID.
So how did Schneider-Electric hide the IP address within the Mac address? By taking advantage of the fact that every device they make has a unique number comprised of three octets, one octet shy of an IP address. You take the Hardware ID, convert it from hexadecimal to decimal and you've got the last 3 octets of an IP address
Converting hexadecimal to decimal can easily be done in Windows using the calculator in programmer mode. As shown below, clicking on HEX and entering 15 will show the Decimal equivalent where is says "DEC".
Alternatively, you can use the excel formula "=HEX2DEC(15)" to easily convert the hexadecimal 15 to the decimal 21.
Putting it all together, here's how it works:
IP address Octet 1 will always be 84
IP address Octet 2 will be the decimal version of the first octet of the Device ID (or the fourth grouping of hexadecimal numbers in the MAC address). In the photo of the M430 this results in 21.
IP address Octet 3 will be the decimal version of the second octet of the Device ID (or the fifth grouping of hexadecimal numbers in the MAC address). In the photo of the M430 this results in 148.
IP address Octet 4 will be the decimal version of the third octet of the Device ID (or the sixth grouping of hexadecimal numbers in the MAC address). In the photo of the M430 this results in 9.
The final default IP address of this M340 would be 126.96.36.199. Now that you know the trick, it's incredibly easy to connect to an M340 right out of the box without even having to track down a Mini-USB cable.