48bit MAC Address Module for Grove

Japanese page

This module is equipped with an I2C-connected EEPROM 24AA025E48 (Microchip Inc.) with a pre-written MAC address and a Grove-compatible connector.
A unique 48-bit MAC address (EUI-48) can be assigned to network-connected devices such as Ethernet, Wi-Fi, and Bluetooth.
A sticker with the MAC address is also included in the package.

Part Names

Included Items

* Sticker with MAC address can be attached to the back of the board as shown below.

Specification

Documents

Schematic

Dimensions

DXF File: dimension_dxf.zip

3D CAD Data

STEP File:3d_step.zip

Sample Code

M5Stack Core2

See wiring diagram and sample code

#include <M5Core2.h>

#define MAC_24AA02Exx_DEV_ADDR        0x50
#define MAC_24AA02Exx_REG_ADDR_MAC    0xF8

void setup() {
  M5.begin(true, true, true, true);
  M5.Lcd.setTextSize(2);

  Wire.beginTransmission(MAC_24AA02Exx_DEV_ADDR);
  Wire.write(MAC_24AA02Exx_REG_ADDR_MAC);
  Wire.endTransmission(false);
  Wire.requestFrom(MAC_24AA02Exx_DEV_ADDR, 8);
  uint8_t MAC_addr_buf[8] = {'\0'};
  for(int i = 0; i < 8; i++)
    MAC_addr_buf[i] = Wire.read();

  // Determine whether the MAC address is EUI-48 or EUI-64
  int MAC_bytes;
  uint8_t MAC_addr[8] = {'\0'};
  if( (MAC_addr_buf[0] == 0xFF) && (MAC_addr_buf[1] == 0xFF) ) {
    MAC_bytes = 6;  // EUI-48 (24AA02xE48)
    memcpy(MAC_addr, MAC_addr_buf + 2, MAC_bytes);
  } else {
    MAC_bytes = 8;  // EUI-64 (24AA02xE64)
    memcpy(MAC_addr, MAC_addr_buf, MAC_bytes);
  }

  // print MAC address
  M5.Lcd.print(8 * MAC_bytes);
  M5.Lcd.println("bit MAC address");
  for(int i = 0; i < MAC_bytes; i++) {
    char strBuf[3];
    sprintf(strBuf, "%02X", MAC_addr[i]);
    M5.Lcd.print(strBuf);
    if(i < (MAC_bytes - 1))
      M5.Lcd.print(":");
  }
  M5.Lcd.println();
}

void loop() {
}

Arduino

Source code: 24AA025Exx_sample.ino

Nucleo

Source code using NUCLEO-L476RG is here (IDE:SW4STM32)