Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

Mongoose OS Giving the Wrong MAC Address on ESP8266?

I encountered a very weird problem with my ESP8266 development device with the MAC address. I was doing this work on an AT&T network. When I launch the UI, mos was telling me the MAC Address was A220.... , but when the network was getting the MAC Address on my HTTP or MQTT requests, the device was sending A020.... Only the second digit was off. I am not misreading the MAC address from mos. Everything else was the same. I don't know if this is a device error, a mos error, or a AT&T error. Is there anyway to confirm or test what the problem might be, or what the real MAC address is? I tried with a ESP32 development board and did not have the same problem.

Comments

  • rojerrojer Dublin, Ireland

    WiFi station and AP have different MAC addresses. the difference is exactly as you describe: one digit.
    for example, a device can have AP MAC a2:20:a6:14:01:23 and STA MAC a0:20:a6:14:01:23.

  • How can I find the STA MAC address from mos? The reason I need that is to whitelist devices and it would be nice to pull that up easily.

  • rojerrojer Dublin, Ireland

    there is currently no MGOS API for that, but you can use SDK API:

    #include <user_interface.h>
    
    ...
    uint8_t mac[6]
    wifi_get_macaddr(STATION_IF, mac);
    ...
    
  • Thanks you!

  • mookiedogmookiedog Washington, USA

    Forgive me, I am such a newbie. I tried the example above, and when I build, I get:

    "fatal error: user_interface.h: No such file or directory"

    Is there something I need to download or install to get access to these files?

  • mookiedogmookiedog Washington, USA

    OK, I made one big mistake: the title of this thread was "...ESP8266", and I am using an ESP32. But for any ESP32 users who google this thread, the ESP32 answer appears to be:

    #include <esp_wifi.h>
    ...
    uint8_t mac[6];
    esp_wifi_get_mac(ESP_IF_WIFI_STA, mac);
    ...
    Thanked by 1Sergey
Sign In or Register to comment.