Conflicting MAC addresses - Uno R4 wifi

Hello,

I am learning how to use the wifi functionality of my Uno R4 wifi. I am new to wifi networking, so there is a lot to learn.

In the learning process I have found that the MAC address of my Uno appears to be different depending on where I get the data - From the WiFi.BSSID() function I get once address, and from my wifi router (Thomson TG784 Gateway) its provides the physical address *should be MAC address for the Uno as something totally different. Both results are in the correct format, and look like MAC addresses and they remain consistent, but different (there is no randomization going on that I can tell).

Can anyone explain why they would be different, and which one is the actual correct one?

Thanks, Steven Lightfoot

Not sure if I understand the question and networking is not my specialty.

Reading up what BSSID is, the BSSID is the MAC of the router that you connect to.
This will be different for the Uno's MAC address which is stored in the Uno.

Interesting that you saw BSSID, but not

    /*
     * Get the interface MAC address.
     *
     * return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
     * 
     * the value returned by this function is meaningfull only if called 
     * afert a begin (both begin or beginAP) or a ScanNetwork function
     * otherwise an empty mac address is returned
     */
    uint8_t* macAddress(uint8_t* mac);

Note that third paragraph in the comment. You can see this code in the WiFi.h header file. One easy way to browse this from the IDE is if you have

#include <WiFi.h>

It may require a successful Verify/compile. But if you hover over the file name, a tooltip should show the full path to the file. And you can also right-click it and choose Go to Definition to open the file in the IDE. You can also Go to Definition from any use of the global WiFi variable.

If it helps, note the phrasing for these two

    /*
     * Return the current SSID associated with the network
     *
     * return: ssid string
     */
    const char* SSID();

    /*
      * Return the current BSSID associated with the network.
      *
      * return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
      */
    uint8_t* BSSID(uint8_t* bssid);

"associated with the network" (the connected AP) versus "the interface". There's also another overloaded version of BSSID with no comment

    uint8_t* BSSID(uint8_t networkItem, uint8_t* bssid);

Reading some of the other function comments, the networkItem is the base-zero index of the Access Point found by scanNetworks; and that function returns the number of APs found. So this allows you to get the MAC of each AP.

Perfect, thanks I got confused between BSSID and MAC address methods in wifi. Its clear now, I get the same reading of the MAC address for my Uno!

Thanks, yes, I was getting confused between the two, its now clear. Obviously I am a networking newbie!

I have two Uno R4 wifis in my house now, and I want them to talk to each other via the wifi network (and bypassing the new Arduino cloud) so I need to learn wifi networking from the ground up, starting at zero. Lots of mistakes to be made. Appreciate the help. Steven Lightfoot