Wiznet makers

gunn

Published April 02, 2026 ©

75 UCC

0 VAR

0 Contests

0 Followers

0 Following

Original Link

Generating Unique MAC Addresses for RP2040 W5500

Generating Unique MAC Addresses for RP2040 W5500

COMPONENTS Hardware components

WIZnet - W5500

x 1


PROJECT DESCRIPTION

This article covers the MAC address duplication issue and its solution that arises when deploying multiple IoT devices using the RP2040 (Raspberry Pi Pico) + W5500 combination.

Key Problem: Since the W5500 does not have pre-assigned MAC addresses, hardcoding the same MAC address across multiple devices results in ARP conflicts and database errors.

Recommended Solution: Read the factory-programmed 64-bit unique hardware ID (pico/unique_id.h) from within the RP2040 and convert it into a 6-byte MAC address. Set the first byte to 0x02 to set the LAA (Locally Administered Address) bit, preventing conflicts with OUI-registered addresses. The generated MAC address remains the same upon booting but is unique to each device, allowing it to be used as a device identification key in Django/PostgreSQL backends.

Alternatives introduced include external MAC EEPROM ICs, hash-based generation, DHCP hostnames, and LittleFS file storage methods.

Definition of the Role of the W5500

The W5500 is a hardwired TCP/IP offload Ethernet controller. To summarize its role in this document:

**Role Description**
**Network Interface**
**Provides wired Ethernet connection capabilities to the RP2040 (MCU)**
**Hardware Processing**
**Hardware Processing**
**Processing TCP/IP protocols directly within the chip without burdening the MCU's software**
**MAC Address Receptor**
**Since it does not possess a proprietary MAC address, it receives a MAC address assigned by the firmware and uses it for device identification on the network**
**SPI Interface**
**Communicates with the RP2040 via SPI (CS pin, etc.) to transmit and receive data**

In a single line: "The W5500 is a controller that provides the Ethernet MAC/PHY and TCP/IP stack in hardware so that the RP2040 can communicate with the Internet." It does not possess a MAC address internally, so developers must assign one directly at the firmware level. This is the characteristic of the WIZnet W5500 and the starting point for the issues raised in this article.

======

이 글은 RP2040(Raspberry Pi Pico) + W5500 조합으로 다수의 IoT 기기를 배포할 때 발생하는 MAC 주소 중복 문제와 그 해결책을 다룹니다.
핵심 문제: W5500에는 사전 할당된 MAC 주소가 없어, 여러 기기에 동일한 MAC을 하드코딩하면 ARP 충돌 및 DB 오류가 발생합니다.
권장 해결책: RP2040 내부에 공장 프로그래밍된 64-bit 고유 하드웨어 ID(pico/unique_id.h)를 읽어와 6바이트 MAC 주소로 변환합니다. 이때 첫 번째 바이트를 0x02로 설정해 LAA(Locally Administered Address) 비트를 세팅, OUI 등록 주소와의 충돌을 방지합니다. 이렇게 생성된 MAC은 부팅할 때마다 동일하지만 기기마다 고유하여, Django/PostgreSQL 백엔드에서 기기 식별 키로 활용 가능합니다.
대안으로는 외부 MAC EEPROM IC, 해시 기반 생성, DHCP 호스트네임, LittleFS 파일 저장 방식 등이 소개됩니다.

W5500의 역할 정의
W5500은 하드와이어드(Hardwired) TCP/IP 오프로드 이더넷 컨트롤러입니다. 이 문서에서의 역할을 정리하면:
역할설명네트워크 인터페이스RP2040(MCU)에 유선 이더넷 연결 기능을 부여TCP/IP 스택 하드웨어 처리MCU의 소프트웨어 부담 없이 TCP/IP 프로토콜을 칩 내부에서 직접 처리MAC 주소 수용체자체 고유 MAC이 없으므로, 펌웨어가 부여한 MAC을 받아 네트워크 상에서 기기 식별에 사용SPI 인터페이스 연결RP2040과 SPI(CS핀 등)로 통신하며 데이터 송수신
한 줄로 정의하면: "W5500은 RP2040이 인터넷과 통신할 수 있도록 이더넷 MAC/PHY 및 TCP/IP 스택을 하드웨어로 제공하는 컨트롤러"이며, MAC 주소는 자체 보유하지 않아 개발자가 펌웨어 단에서 직접 할당해야 합니다. 이것이 WIZnet W5500의 특성이자, 이 글의 문제 제기 출발점입니다.

Documents
Comments Write