Copyright ©

Mongoose OS Forum


MAC Addres

Good day!

I have an esp8266 running connected to a COM port. When I open the console and reboot the board, then the OS shows me the device's MAC addres. But, when I look at the connected devices in my network (look into arp table), I could see the MAC isn't the same. The MAC informed by Mongoose os starts with 5E:CF:7F, and I think ESPRESSIF's MAC address should start with 5C:CF:7F (i've cheked here:
Does Mongoose OS get the vendor's portion of MAC address from the chip or is it written in some file?

Thanks in advace!



  • rojerrojer Dublin, Ireland

    ESP devices use different MAC for AP and STA modes, they differ by prefix and latter bytes are the same.

  • Fede_1988Fede_1988 Argentina
    Ahh! Then in my console i'm looking at the softAP MAC. How should i do to get the sta mac addres? Later on, esp8266 will have to inform it through an AP connection. Thank you!!
  • rojerrojer Dublin, Ireland

    device_get_mac_address returns AP's MAC, there is currently no way to get STA MAC.
    are you interested in a C or JS API?

  • Fede_1988Fede_1988 Argentina

    I'm using C.

    Ok then, maybe i can implement a rutine in esp8266 that runs device_get_mac_address and overwrite the first fields with ESPRESSIF code! As soon as i get it working, i'll share it here.


  • rojerrojer Dublin, Ireland

    yeah, they only differ in the first octet. i'll note the ncessity to provide both AP and STA MACs, but cannot promise a quick fix.

  • Fede_1988Fede_1988 Argentina

    Here's a workaround:
    Get's AP mac address in specified uint8_t array, overrite vendors field to get correct sta MAC address, and also converts to string.

    void get_mac_address (uint8_t * mac_uin8t, char * mac_str)
        *mac_uin8t=0x5C;                //Originally informs 5E (AP MAC ADDRESS)
        *(mac_uin8t+1)=0xCF;                            //Not really necessary
        *(mac_uin8t+2)=0x7F;                            //Not really necessary
        sprintf(mac_str, "%02x%02x%02x%02x%02x%02x\n", mac_uin8t[0]&0xFF,mac_uin8t[1]&0xFF,mac_uin8t[2]&0xFF,mac_uin8t[3]&0xFF,mac_uin8t[4]&0xFF,mac_uin8t[5]&0xFF);

    Hope it's helpful to someone


Sign In or Register to comment.