This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
i want to change the MAC address for the etherent interface on a TM4C1294NCPDT.
Unfortunately it cannot be changed by initializing the Ethernet interface directly with another MAC address, which is not the MAC address in the UserRegister 0 and 1.
If you initialize the Ethernet interface with the values in User Register 0 and 1, the interface will work, otherwise it will not work.
But I can't change these values in the User Registers either, neither in source code nor with Uniflash.
Has TI assigned fixed MAC addresses to the microcontrollers that cannot be changed?
Can User Registers 0 and 1 be written to only once.
Why is user register 0 and 1 directly related to the Ethernet interface so that the interface only works with those values as MAC address and not otherwise?
With kind regards
Ali
Hello Ali,
The User Register 0 and 1 can be erased by using the Device Unlock Process.
With a blank part, or once a previously programmed part has gone through the Device Unlock Process, you are about to 'one-time' program the MAC address into User Register 0 and 1.
After that, you must clear the registers through the Device Unlock Process to change their value, hence 'one-time' as it's not quite true OTP but pretty close to it.
You can unlock the device with Uniflash or LM Flash Programmer.
Thank you for the answer.
There is still the question, why the User Register 0 and 1 are related to the Ethernet Interface. If only there the MAC address can be stored, why there is the need, to get the values out of the registers and initialize the MAC address again in the source code, where no other MAC address is possible.
It would be reasonable, if the TI microcontroller would automatically fetch the values out of the user registers without doing it manually in the source code while initialization the ethernet interface.
Hello Ali,
That is because of how MAC Addresses must be handled.
"Any device that has an Ethernet interface requires a unique ‘MAC’ address, which is programmed at the point of manufacture. This address is literally unique – every Ethernet device in the world has a different MAC address. (The MAC address should not be confused with a devices IP address, which is an entirely separate address that does not have to be unique across the world). If you are manufacturing a product that includes an Ethernet interface you will need purchase a block of MAC addresses."
Because of this, you cannot just program a MAC Address in a source code binary and then program 1000 devices and still have each with a unique MAC Address. You would need an individual application binary that is compiled with the unique MAC address for every single device going through a production line and no company would ever do this.
The TM4C User Register's solve this program, allowing for quick programming on production line of the unique MAC Address for each device by just committing to the two registers, and then you are back to having only one application binary is needed to Flash the device with your program. Quick, easy, and very cost-effective.
Oh and I forgot to add - the reason it's one-time programmable is so no one can overwrite your unique MAC address without entirely erasing Flash which would just make the TM4C back to being a blank device. So your products MAC address cannot be changed under any circumstances.
Ralph Jacobi said:"Any device that has an Ethernet interface requires a unique ‘MAC’ address, which is programmed at the point of manufacture. This address is literally unique – every Ethernet device in the world has a different MAC address. (The MAC address should not be confused with a devices IP address, which is an entirely separate address that does not have to be unique across the world). If you are manufacturing a product that includes an Ethernet interface you will need purchase a block of MAC addresses."
I haven't looked into the details of purchasing MAC addresses (from the IEEE, I think?) but I've come across chips that provide over I2C a MAC address, in much the same way as devices which provide a guaranteed-unique ID (for serial numbers or whatever).
Is there any way to hook into the Ethernet driver the ability to read such a little chip and use the provide MAC address? That makes life easier for the small shops that may not want to buy 4,096 MAC addresses early on.
Hello Ralph,
I just have the simple question, if I am able to set the MAC address in the source code. This was not possible so far with this microcontroller.
We use our products just in closed networks without Internet access. Then an easy possibility to set the MAC address at the GUI after production would be good feature.
Or like Andy mentioned, you can also purchase EEPROMs with a factory-programmed IEEE EUI-48 or -64 MAC address, but these have to read out via I2C in the source code. So I don't know why TI has put these constraints on setting the MAC address.
Andy Peters said:I haven't looked into the details of purchasing MAC addresses (from the IEEE, I think?) but I've come across chips that provide over I2C a MAC address, in much the same way as devices which provide a guaranteed-unique ID (for serial numbers or whatever).
Is there any way to hook into the Ethernet driver the ability to read such a little chip and use the provide MAC address? That makes life easier for the small shops that may not want to buy 4,096 MAC addresses early on.
Please refer to the TivaWare ethernet examples. Below is a snippet of code from the enet_io example. You will see the call to IwIPInit() function to initialize the LwIP stacks. One of the arguments to pass to the function is the MAC address. The MAC address is read from USR0/USR1 stored in the non-volatile memory (by calling the MAP_FlashUserGet) . If your MAC address is not stored in the USR0/USR1 but rather in some external device, you just need to modify the code to read the MAC from wherever it is located. There are I2C examples in the TivaWare library. Refer to these examples on how to communicate with your I2C device.
I'm not sure what these I2C devices you are referring to. Perhaps these are devices from another vendor that contains unique MAC addresses allocated to them by IEEE. It is your responsibility to find out if you can use their MAC address to identify your final system/product. This is not a MCU related question we can advice.
// // Configure the hardware MAC address for Ethernet Controller filtering of // incoming packets. The MAC address will be stored in the non-volatile // USER0 and USER1 registers. // MAP_FlashUserGet(&ui32User0, &ui32User1); if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff)) { // // Let the user know there is no MAC address // UARTprintf("No MAC programmed!\n"); while(1) { } } // // Tell the user what we are doing just now. // UARTprintf("Waiting for IP.\n"); // // Convert the 24/24 split MAC address from NV ram into a 32/16 split // MAC address needed to program the hardware registers, then program // the MAC address into the Ethernet Controller registers. // pui8MACArray[0] = ((ui32User0 >> 0) & 0xff); pui8MACArray[1] = ((ui32User0 >> 8) & 0xff); pui8MACArray[2] = ((ui32User0 >> 16) & 0xff); pui8MACArray[3] = ((ui32User1 >> 0) & 0xff); pui8MACArray[4] = ((ui32User1 >> 8) & 0xff); pui8MACArray[5] = ((ui32User1 >> 16) & 0xff); // // Initialze the lwIP library, using DHCP. // lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
Thank you, the problem was another issue reading the MAC-Address from the internal EEPROM, where read/write is only possible with data length of multiple of 4 bytes, works with IP-addresses, but a MAC-address has 6 bytes.