Linux wifi MAC address

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Fininho
Level 1
Level 1
10 sign-ins 5 sign-ins First reply posted

I'm working with an IMX6UL board running and arm32 Debian 9 with U-Boot.
This board has a CYW43353 and we are using the firmware on brcmfmac4339-sdio.bin.

For one of the projects, I need to assign a customized MAC address to the wireless interface.
I know we can set the Ethernet MAC address on the U-Boot, but I am failing to do something similar with the wifi interface.
Is there a way to set a customized MAD address used when the drivers are loaded?

Thank you for your help.

0 Likes
1 Solution
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi @Fininho ,

In the nvram text file, you can set custom MAC to be used by changing the value  "macaddr=aa:bb:cc:dd:ee:ff" where  aa:bb:cc:dd:ee:ff is the MAC address you need to use 

Best Regards

Raks

 

View solution in original post

0 Likes
12 Replies
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

HI @Fininho ,

Welcome to the community.

Let me see how custom MAC could be set. I will check and get back to you.

Thanks and Best Regards,

Rakshith

0 Likes
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi @Fininho ,

In the nvram text file, you can set custom MAC to be used by changing the value  "macaddr=aa:bb:cc:dd:ee:ff" where  aa:bb:cc:dd:ee:ff is the MAC address you need to use 

Best Regards

Raks

 

0 Likes

Thank you for you quick reply.

 

I think the nvram text file on my system is: /lib/firmware/brcm/brcmfmac4339-sdio.txt

Using dmesg I can see this to be drivers load:

"brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac4339-sdio.bin for chip 0x0043
39(17209) rev 0x000002"

 

Now, if that is right, my /lib/firmware/brcm/brcmfmac4339-sdio.txt looks like this:

NVRAMRev=$Rev: 410316 $
sromrev=11
boardrev=0x1203
boardtype=0x06c5
boardflags=0x00000c01
boardflags2=0x00002000
boardflags3=0x8101188
macaddr=00:09:14:c5:12:38
cctl=0
ccode=US
regrev=911
antswitch=0
pdgain5g=7
pdgain2g=7
tworangetssi2g=0
tworangetssi5g=0
femctrl=7
vendid=0x14e4
devid=0x43ae
manfid=0x2d0
nocrc=1
otpimagesize=502
xtalfreq=37400
extpagain2g=2
pdetrange2g=2
extpagain5g=2
pdetrange5g=2
rxgains2gelnagaina0=0
rxgains2gtrisoa0=7
rxgains2gtrelnabypa0=0
rxgains5gelnagaina0=0
rxgains5gtrisoa0=11
rxgains5gtrelnabypa0=0
rxchain=1
txchain=1
aa2g=1
aa5g=1
tssipos5g=0
tssipos2g=0
pa2ga0=-159,5841,-699
pa2gccka0=-162,6244,-755
pa5ga0=-185,5721,-690,-185,5693,-688,-193,5445,-670,-194,5352,-661
pa5gbw40a0=-188,5836,-710,-187,5839,-708,-173,5956,-714,-159,6022,-712
pa5gbw80a0=-184,5789,-700,-185,5784,-700,-175,5797,-699,-172,5749,-692
pdoffset40ma0=0
pdoffset80ma0=0
pdoffsetcckma0=0
maxp2ga0=0x4A
maxp5ga0=0x4A,0x4A,0x4A,0x4A
cckbw202gpo=0x0000
cckbw20ul2gpo=0x0000
mcsbw202gpo=0x66666666
mcsbw402gpo=0x66666666
dot11agofdmhrbw202gpo=0x4444
ofdmlrbw202gpo=0x4444
tssifloor2g=500
mcsbw205glpo=0x22222222
mcsbw405glpo=0x55555555
mcsbw805glpo=0xaaaaaaaa
mcsbw1605glpo=0xffffffff
mcsbw205gmpo=0x22222222
mcsbw405gmpo=0x55555555
mcsbw805gmpo=0xaaaaaaaa
mcsbw1605gmpo=0xffffffff
mcsbw205ghpo=0x22222222
mcsbw405ghpo=0x55555555
mcsbw805ghpo=0xaaaaaaaa
mcsbw1605ghpo=0xffffffff
mcslr5glpo=0x0000
mcslr5gmpo=0x0000
mcslr5ghpo=0x0000
sb20in40hrpo=0x0
sb20in80and160hr5glpo=0x0
sb40and80hr5glpo=0x0
sb20in80and160hr5gmpo=0x0
sb40and80hr5gmpo=0x0
sb20in80and160hr5ghpo=0x0
sb40and80hr5ghpo=0x0
sb20in40lrpo=0x0
sb20in80and160lr5glpo=0x0
sb40and80lr5glpo=0x0
sb20in80and160lr5gmpo=0x0
sb40and80lr5gmpo=0x0
sb20in80and160lr5ghpo=0x0
sb40and80lr5ghpo=0x0
dot11agduphrpo=0x0
dot11agduplrpo=0x0
phycal_tempdelta=25
cckdigfilttype=2
swctrlmap_5g=0x00000008,0x00000010,0x00000008,0x000000,0x038
swctrlmap_2g=0x00000001,0x00000002,0x00000001,0x040002,0x0ff
swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x000
swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x000
muxenab=0x11
rssicorrnorm_c0=3,3
rssicorrnorm5g_c0=2,3,4,2,3,3,0,1,2,0,1,2
paparambwver=1
AvVmid_c0=2,155,2,146,2,150,2,154,2,152
ed_thresh2g=-70
ed_thresh5g=-73
txidxcap2g=0
txidxcap5g=0

 

The MAC address variable is set but is not doing anything. Is it possible I am missing some other parameter to enable the use of the custom MAC address?

Thank you and Best Regards

 

 

0 Likes
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi Fininho,

Yes, the NVRAM file is the .txt file. I don't think you are missing any parameters here. The file looks fine.

One more to do would be to write the required mac to the OTP(One time programmable) memory of the radio. Note that these 502 bytes of the radio is OTP and cannot be reprogrammed. 

In the OTP programming guide here https://www.cypress.com/file/298011/download

In table 7 of section 7 (page 15), the mac address programming is explained. 

I have attached a .bin file. You can edit the bin file using a hex file editor to input your custom mac and then use the wl commands provided in the guide to program the binary map. Let me know if it worked or you faced any issues.

BR,

Raks

 

0 Likes

Hi Raks, thank you for your help, got caught on other things to finish.

 

I have a few questions left.

In the example you sent, the parameter set in the .bin file are these:

sromrev = 0x0B

boardrev=0x1100

boardtype=0x64c

macaddr =0x0000 0000 0000

The values I want to write to the OTP are the ones I have on the brcmfmac4339-sdio.txt file right?

Based on the file I posted before, the hex file should look like this: (the changes are highlighted)

4b00 ffff 0000 2004 d002 7343 8002 000b

8003 0203 1280 031b 5c06 8007 1938 12c5

1409 0000 0000 0000 0000 0000 0000 0000

 

On the brcmfmac4339-sdio.txt file, we have 3 "boardflags" fields, can you send me documentation about what they set? or about the hole setting we can edit on the NVRAM.

 

Finally, I edited the .bin file on the zip file you posted. Then, the wlarm_le seems to work on linux but still returns this erros:

$> ./wlarm_le cisdump

./wlarm_le: /lib/arm-linux-gnueabihf/libnl-genl-3.so.200: no version information available (required by ./wlarm_le)

./wlarm_le: /lib/arm-linux-gnueabihf/libnl-3.so.200: no version information available (required by ./wlarm_le)

./wlarm_le: wl driver adapter not found

 

The first two seem OS relates and I need to fix them, do you have any clue about the latest one: "./wlarm_le: wl driver adapter not found".

Also, probably I should have started by replacing these brcmfmac4339-sdio with the Cypress ones. If you think this change can make the difference, can you point me to where I can get this driver? then I think I can use the modprobe to unload the brcm drivers and load the Cypress ones.

 

 

Thank you for your help.

BR,

   Ademar

0 Likes
lock attach
Attachments are accessible only for community members.
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi Ademar,

The actual values of sromrev,boardrev, baordtype could be different on your board. So you can run "wl cisdump" to print out the current values in the OTP. For cisdump command to work, you should be using the mfg firmware.

Next, you can leave out the fields which already contain data (since you cannot overwrite OTP) to zero in your OTP bin file and can write the mac in the OTP addresses that are free (contains 0s).

So, in this case, you can write 80 07 19 00 09 14 c5 12 38

Text in Italics is the header, bold one is your mac address.

Except for these bits, the rest of the addresses should be 0 in the bin file which you will be writing.

The boardflags parameters are used for configuring power, external hardware like oscillators by the module vendor. Full info on it cannot be disclosed however there is some basic info on different parameters on page 6 in the document https://www.cypress.com/file/298011/download . If you have any specific questions with respect to the values you can get in touch with the module vendor.

WL-Tool:

The first two errors are from libnl, you can try to install them from source or using "sudo apt-get install -y libnl-genl-3-dev"

Make sure to run the wl tool as super/root user.

Was this particular tool provided to you by the module vendor? Can you try with the two versions that I have attached in the zip?

Thanks and Best Regards,

Rakshith

0 Likes
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi, 

Let me know if you were able to use the custom MAC, or if you faced any other issues.

Thanks

0 Likes
lock attach
Attachments are accessible only for community members.
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Added attachment

0 Likes
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi Fininho,

 

Hope this method worked for you Let me know if it worked or you faced any issues.

BR,

Raks

0 Likes

Hi Rakshith,

Thank you for sending me these wl binaries, the wl_rpi worked on my system but still can't use it to write on the OTP.
These are the outputs for some commands:
> sudo ./wl_rpi cisdump
Failed cisdump request: -45
./wl_rpi: error -23

> sudo ./wl_rpi manfinfo
./wl_rpi: error -23

> sudo ./wl_rpi revinfo
vendorid 0x14e4
deviceid 0x43e2
radiorev 0x3da000
chipnum 0xa9a6
chiprev 0x1
chippackage 0x3
corerev 39.0
boardid 0x726
boardvendor 0x14e4
boardrev P101
driverrev 7.45.98.65
ucoderev 0x4130845
bus 0x0
phytype 0xc
phyrev 0.0
anarev 0x0
nvramrev 0

Sometimes I also get this output:
"wl driver adapter not found"


I don't know what these error codes mean.
I am testing it on a Debian 11 using brcm/brcmfmac43430-sdio.bin driver, on other versions of our product we use brcmfmac4339-sdio.bin.
Let me know if you need more information.

Thank you for your help.
Best regards,
   Ademar

0 Likes
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi Ademar,

The cisdump command works only with the manufacturing test firmware(mfg firmware), please make sure you are using that and not the production firmware. 

The error code -23 is returned when a unsupported command is entered. To the production firmware, cisdump is an unsupported command where as it will work with the mfg firmware.

If you do not have the mfg firmware then it can be requested from Murata(or your module maker). 

And "wl driver adapter not found" could be because of the wlan interface not being up. Do you randomly see this or do you observe this after running any particular command?. Once you insmod the .ko files and the wlan interface is up, you should not be seeing this message. 

Once you have the mfg firmware you can run

./wl wrvar macaddress=00:11:22:33:44:55 to write the mac to OTP . 

 

Thanks,

Rakshith

0 Likes

Hi Rakshith,

Thank you for your quick reply and explanation.
In my case, I guess I have to contact Variscite.
About the "adapter not found" I think you are right, I was trying to run it on a root cronjob but maybe the interface was not up at the time the command run.

BR,
Ademar

0 Likes