WL18xx Writing MAC address

From Texas Instruments Wiki
Jump to: navigation, search

Overview

During production the next two addresses after the Bluetooth® device address (BD_ADDR) are reserved for WLAN and can be derived automatically from the BD_ADDR at runtime.

Deriving the WLAN Addresses

The WLAN MAC addresses for the supported devices are derived as follows:

  • BD_ADDR: 08:00:28:00:00:00
  • WLAN 1: 08:00:28:00:00:01
  • WLAN 2: 08:00:28:00:00:02

When deriving the WLAN addresses from the BD_ADDR, ensure that the organizational unique identifier (OUI) is not changed.
The OUI (first 3 bytes) is pre-assigned by the IEEE to different companies (for example, the TI OUI is 08:00:28). The company that owns the OUI assigns the network identification card (NIC) address (last 3 bytes).

Addresses Assigned by the Customers

Customers can use either the TI MAC addresses assigned to the device or their own addresses, in which case the OUI represents their own company's address. The nvs file includes a MAC address field to support the assignments. If a MAC address is available in the .nvs file, the address overrides the addresses assigned by TI during production. The MAC address written in the .nvs file represents the first WLAN address (WLAN 1); incrementing this first address derives the second address. Thus, when customers assign their own MAC addresses, they must assign two consecutive MAC addresses per device, writing the first one in the .nvs file.

NoteNote: If an overflow occurs while deriving the second MAC address, wrap around the NIC part without changing the OUI in the same way as described above (Deriving the WLAN Addresses).


Setting a Permanent MAC Address in the NVS File


In order to set a permanent MAC address to the device use the calibrator tool as follows:

calibrator set nvs_mac /lib/firmware/ti-connectivity/wl1271-nvs.bin <mac addr>

NoteNote: To use the MAC addresses assigned to the device by TI set the MAC address in the nvs file to be blank (00:00:00:00:00:00).

In order to get the permanent MAC address that was written to the nvs file use the calibrator tool as follows:

calibrator get nvs_mac /lib/firmware/ti-connectivity/wl1271-nvs.bin

NoteNote: unloading and loading the driver is required in order for the change to take effect.

To verify that the MAC address was properly changed, use the ifconfig function as follows:

root@am37x-evm:~# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 08:20:00:33:65:29
          inet addr:192.168.3.10  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14048740 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20805996 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3296646156 (3.0 GiB)  TX bytes:1748711212 (1.6 GiB)