Changes

Jump to: navigation, search

DESK-MX8M-L/Deployment/MAC Address programming

6,441 bytes added, 08:22, 21 June 2022
Created page with "<section begin=History/> {| style="border-collapse:collapse; " !colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History |- !style="border-le..."
<section begin=History/>
{| style="border-collapse:collapse; "
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
|-
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Version
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|{{oldid|14303|1.0.0}}
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Jun 2022
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First release
|-
|}
<section end=History/>

__FORCETOC__
<section begin=Body/>

== MAC Address programming ==
Every network adapter has a Media Access Control address (usually shortened to MAC address). A MAC address is a six-byte identifying number permanently embedded in the firmware of the adapter, and is readable by the network and the operating system of the device on which the adapter is installed.

The address must follow the standards set by the [https://standards.ieee.org/products-services/regauth/index.html Institute of Electrical and Electronics Engineers (IEEE)], which sets computer networking standards.

The MAC address is a six-pair set of hexadecimal numbers, for example <code>a1-c2-e3-44-5f-6d</code>. Specifically, in Ethernet, the MAC address is known as the Ethernet Address, which is the unique ID serial number of the Ethernet device in one's computer. MAC Addresses are used in a Local Area Network (LAN) by computers to communicate with each other. Every adapter has a unique MAC address.

In this Application Note, we will describe how to use the i.MX eFuses for programming and using the MAC address(es).

=== Obtaining a MAC address ===
To obtain a MAC address for your organization, please refer to our [[Deploying_Embedded_Linux_Systems#Setting_the_MAC_address_of_network_interfaces | Setting the MAC address]] wiki page with the overall information about this topic.

=== Permanent storage areas ===
Some SOCs provide programmable OTPs for security, MAC address, boot modes, etc. Usually, some of these are general-purpose registers and can be managed by the user.

In other cases, an external permanent storage device can be used for storing permanent settings like the MAC address: for the i.MX SoC product family, DAVE proposes to use the ''General Purposes eFuses'' (OTP blocks) on SoC itself for storing permanently the MAC address(es).

=== MAC address programming ===

==== MAC address configuration in u-boot====

The MAC Address programming in u-boot is explained in [https://solidrun.atlassian.net/wiki/spaces/developer/pages/287178818/i.MX8M+Ethernet+MAC+Address+Fusing this guide] as per the NXP suggested link in the support forum.

If the MAC address is not already programmed in the OTPs and the <code>ethaddr</code> u-boot variable is not set, u-boot assignes a random value (different at every power on cycle):

Net:
Warning: ethernet@30be0000 (eth0) using random MAC address - 6e:e5:6d:a2:ea:e5
eth0: ethernet@30be0000

If the <code>ethaddr</code> is set and saved in the u-boot environment, it's value is used as the MAC Address:

u-boot=> setenv ethaddr 00:50:C2:1E:AF:CB
u-boot=> saveenv
Saving Environment to MMC... Writing to MMC(1)... OK
u-boot=>

==== eFuses programming ====

Use these U-Boot commands to store the example MAC address <code>00:50:c2:1e:af:cd</code> on i.MX SOM:
* (in case of presence) clear the <code>ethaddr</code> u-boot variable
<pre class="workstation-terminal">
u-boot=> setenv ethaddr
u-boot=> saveenv
Saving Environment to MMC... Writing to MMC(1)... OK
</pre>
* program the MAC address in the OPTs with the following commands:
<pre class="workstation-terminal">
u-boot=> fuse prog 9 0 C21EAFCD
Programming bank 9 word 0x00000000 to 0xc21eafcd...
Warning: Programming fuses is an irreversible operation!
This may brick your system.
Use this command only if you are sure of what you are doing!

Really perform this fuse programming? <y/N>
y
u-boot=> fuse prog 9 1 0050
Programming bank 9 word 0x00000001 to 0x00000050...
Warning: Programming fuses is an irreversible operation!
This may brick your system.
Use this command only if you are sure of what you are doing!

Really perform this fuse programming? <y/N>
y
u-boot=>
</pre>

At the next boot, the <code>ethaddr</code> value wil be read from the OPTs:
<pre class="workstation-terminal">
Warning: ethernet@30be0000 using MAC address from ROM
eth0: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
u-boot=> print ethaddr
ethaddr=00:50:c2:1e:af:cd
u-boot=>
</pre>

The warning message informs that the <code>ethaddr</code> is not present in the u-boot environment and it has been set using the value read from the OTPs. For clearing the warning, it is enough to save the environment with <code>saveenv</code>.
<pre>
u-boot=> saveenv
</pre>

=== Linux kernel MAC address ===

The MAC Address configured in u-boot is passed to the kernel which configures the <code>eth0</code> peripheral with the correct value:
<pre class="workstation-terminal">
root@desk-mx6:~# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:50:c2:1e:af:cd
inet addr:192.168.0.90 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::fc23:36ff:fe24:aeb3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17748 errors:0 dropped:0 overruns:0 frame:0
TX packets:13811 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19833087 (18.9 MiB) TX bytes:1908941 (1.8 MiB)

root@desk-mx6:~#
</pre>
8,221
edits

Navigation menu