Retrieving MAC(WLAN) from XDK
6/14/19 11:36 AM

Hi everyone,

I want to retrieve the unique WLAN Mac Adress of the XDK. in the: XX-XX-XX-XX-XX-XX format.

If found this thread:

but it doesn't work for me. They used the following code snippet:

_u8 macAddressVal[SL_MAC_ADDR_LEN];
_u8 macAddressLen = SL_MAC_ADDR_LEN;
sl_NetCfgGet(SL_MAC_ADDRESS_GET,NULL,&macAddressLen,(_u8 *)macAddressVal);
 // The 6 bytes of the Mac address are now stored in the array macAddressVal

The reason (probably) beeing is that it dont know where/what to initialize/define the "SL_MAC_ADDR_LEN".

Is this the only/fastest way to get the Mac Adress?

And another question is, that this example code uses "WlanConnect_Init()" i use for my sourcecode "Wlan_Enable()" does that make a difference or may i be able to get the Mac Adress the same way?


Thank you in advance for your help.

0 (0 Votes)
RE: Retrieving MAC(WLAN) from XDK
6/14/19 2:18 PM as a reply to Martin Scheck.

Hi Martin,

Define it like this:
#define SL_MAC_ADDR_LEN                    UINT8_C(6)

I think that's the easiest and fastest way to get the MAC address. Regarding your last question, It should work because the function Wlan_Enable() initializes the WLAN connection.




+1 (1 Vote)
RE: Retrieving MAC(WLAN) from XDK
6/17/19 10:57 AM as a reply to Saeid Kajlar.
Works perfectly now. Thank you very much!
0 (0 Votes)