Wiznet makers

gavinchang

Published March 13, 2026 ©

82 UCC

25 WCC

61 VAR

0 Contests

4 Followers

0 Following

Original Link

How to Build Secure Local Data Storage with W5500 on an MCU Edge Device?

This project describes a maker-oriented edge-device architecture that combines the W5500 with local encryption and integrity checks so an MCU-class system can k

COMPONENTS
PROJECT DESCRIPTION

How to Build Secure Local Data Storage with W5500 on an MCU Edge Device?

Summary

This project describes a maker-oriented edge-device architecture that combines the W5500 with local encryption and integrity checks so an MCU-class system can keep network communication lightweight while protecting sensitive data at rest. In this design, the W5500 handles wired TCP/IP connectivity and socket transport, while the MCU uses AES-based encryption, HMAC verification, and external storage control to keep local AI or voice data protected.

What the Project Does

The source presents a local security architecture for an AI edge device that needs to store sensitive data such as voice-related features or user behavior records without relying entirely on cloud services. The stated design goal is to let a small MCU maintain stable Ethernet connectivity through the W5500 while encrypting local data before it is written to flash and verifying integrity through HMAC during later reads or boot-time checks.

Architecturally, the system is divided into three layers: an application layer that produces AI or voice data, a security middleware layer that performs AES encryption, HMAC-SHA256 signing, and key management, and a hardware layer built from the MCU, the W5500 Ethernet interface, and SPI flash. The article’s data flow is explicit: plaintext is generated locally, encrypted, signed, stored with IV and HMAC, and optionally transmitted later over a TCP connection established through the W5500.

For maker use, the important point is that this is not just a networking example and not just a crypto example. It is a practical split between communication offload and local data protection on resource-constrained hardware. The article explicitly frames the target as MCU-class devices with limited RAM and clock speed, where a simpler Ethernet path helps leave more CPU time for AI or application logic.

Where WIZnet Fits

The exact WIZnet product here is the W5500. In this architecture, it is the wired transport engine rather than the security engine. It handles Ethernet connectivity, TCP socket setup, and ongoing link management so the MCU does not need to run a full software TCP/IP stack while also managing encryption and storage. The article’s own initialization example uses W5500 register calls such as setSHAR, setSIPR, setSUBR, setGAR, setPHYCFGR, socket, and connect, which makes its role in the system concrete.

That separation matters on small boards. The article claims that W5500 reduces CPU overhead compared with software-stack approaches and positions it as a way to preserve MCU resources for application-side tasks. The source also claims support for eight sockets, 8 KB per socket cache, sub-10% CPU usage, and throughput near 80 Mbps at a 70 MHz SPI clock, but those numbers are presented in the article without linked measurement methodology, so they should be treated as article claims rather than independently verified benchmarks.

For a maker edge device, W5500 is a good fit when the design priority is predictable wired networking and a clean software boundary. The MCU remains responsible for key handling, encryption workflow, HMAC validation, and flash writes, while W5500 keeps the network side close to a socket-driven control model instead of a full software networking stack. That division is the main architectural value in this project.

Implementation Notes

This project does use WIZnet products, and the article includes visible code snippets, but it does not provide a public repository with file paths or line-addressable source files. I therefore cannot verify a repository-backed codebase. The implementation details below are limited to what is explicitly visible in the article itself.

The first visible implementation element is a W5500 initialization routine shown inline in the article:

void W5500_Init(void) { ... setSHAR(mac); setSIPR(ip); setSUBR(sn); setGAR(gw); setPHYCFGR(PHYCFGR_DEFAULT); socket(0, Sn_MR_TCP, 5000, 0); connect(0, remote_ip, 5001); }

Why it matters: this shows the intended transport boundary very clearly. The MCU initializes SPI, resets the W5500, programs MAC and IPv4 settings, enables PHY auto-negotiation, then opens a TCP socket through the W5500. That is the network side of the system, and it exists to support the secure edge workflow rather than to dominate firmware complexity.

The second visible implementation element is the local encryption wrapper shown in the article:

int encrypt_data(const uint8_t *plain, int len, uint8_t *cipher) { aes_set_key(&aes_ctx, key, 256); return aes_crypt_cbc(&aes_ctx, AES_ENCRYPT, len, iv, plain, cipher); }

Why it matters: this confirms that the project’s security model is application-layer encryption plus integrity checking on top of W5500-based transport, not transport-layer security implemented inside the Ethernet chip. The W5500 moves data; the MCU-side security layer protects what is stored and what may later be sent.

The article also gives the higher-level storage path: data is generated by the application, encrypted, signed with HMAC, then written to external flash together with IV and integrity metadata. On boot, stored data is checked again through HMAC validation, and the device enters a lock state if verification fails. That is the core system behavior here, and it explains why W5500 is paired with encryption rather than presented as a standalone networking feature.

Practical Tips / Pitfalls

Do not treat W5500 as a security feature by itself. In this design, it provides Ethernet transport only; AES, HMAC, and key handling are implemented outside the W5500.

Be careful with the article’s performance numbers. The source makes strong claims about low CPU load and high throughput, but it does not publish benchmark conditions or measurement data.

Never hardcode encryption keys in normal firmware flash. The article explicitly warns against that and recommends injected per-device keys or derivation from MCU identity.

Do not reuse IVs in CBC mode. The source explicitly says IVs must be different and unpredictable for each encryption operation.

Keep flash writes atomic when storing encrypted records. The article recommends temporary-page writing and pointer switching to avoid partial ciphertext writes after power loss.

Validate integrity before trusting stored data. The article’s boot-time HMAC verification and lock-on-failure behavior are important because encryption alone does not stop tampering.

FAQ

Why use the W5500 in this project?
Because the project needs wired TCP/IP connectivity on a small MCU that is already busy handling encryption, integrity checks, and local storage logic. The W5500 keeps network handling simple and hardware-assisted so the MCU can spend more time on application and security functions.

How does it connect to the platform?
The article shows the W5500 being brought up through SPI initialization and reset, followed by register-level configuration for MAC address, IP address, subnet mask, gateway, PHY configuration, and socket setup. That means the platform interface is an external MCU plus SPI-controlled W5500 network controller.

What role does it play in this specific project?
It is the communication layer for secure local AI data handling. The device uses W5500 to maintain TCP connectivity, while the MCU encrypts local records, computes HMAC signatures, stores ciphertext in flash, and optionally transmits protected data later.

Can beginners follow this project?
Yes, but it is better suited to makers who already understand SPI peripherals, TCP socket basics, and elementary cryptography concepts. The networking side is relatively approachable because W5500 keeps it socket-oriented, but the full project also requires careful handling of keys, IVs, and storage integrity.

How does this compare with LwIP?
The article explicitly positions W5500 as a lower-overhead alternative to a software-stack approach on small MCUs. That can simplify integration, but the article does not provide side-by-side measurements. The defensible comparison is architectural: LwIP gives more software flexibility, while W5500 reduces stack burden and keeps the firmware model closer to register setup plus socket operations.

Source

Original link: CSDN article “W5500以太网接入实现小智AI本地数据加密存储安全架构.” The page states CC 4.0 BY-SA and presents a W5500-based local encryption and storage architecture for an MCU-class AI edge device.

Tags

W5500, WIZnet, Embedded Ethernet, Secure Storage, AES, HMAC, Edge AI, Maker, TCP Socket, SPI Flash, Local Data Protection, MCU Security

 

MCU 엣지 디바이스에서 W5500으로 안전한 로컬 데이터 저장 구조를 어떻게 구축할 수 있을까?

Summary

이 프로젝트는 W5500과 로컬 암호화 및 무결성 검증을 결합해, MCU급 시스템이 네트워크 통신은 가볍게 유지하면서도 민감한 데이터를 로컬에 안전하게 저장할 수 있도록 구성한 메이커 지향 엣지 디바이스 아키텍처를 설명한다. 이 설계에서 W5500은 유선 TCP/IP 연결과 소켓 전송을 담당하고, MCU는 AES 기반 암호화, HMAC 검증, 외부 저장장치 제어를 통해 AI 또는 음성 관련 로컬 데이터를 보호한다.

What the Project Does

이 소스는 음성 특징값이나 사용자 행동 기록 같은 민감한 데이터를 클라우드에만 의존하지 않고 로컬에 저장해야 하는 AI 엣지 디바이스용 보안 아키텍처를 제시한다. 설계 목표는 소형 MCU가 W5500을 통해 안정적인 이더넷 연결을 유지하는 동시에, 데이터를 플래시에 기록하기 전에 암호화하고, 이후 읽기나 부팅 시점에 HMAC으로 무결성을 검증하도록 만드는 것이다.

아키텍처는 세 계층으로 나뉜다. 하나는 AI 또는 음성 데이터를 생성하는 애플리케이션 계층, 다른 하나는 AES 암호화, HMAC-SHA256 서명, 키 관리를 수행하는 보안 미들웨어 계층, 마지막 하나는 MCU, W5500 이더넷 인터페이스, SPI 플래시로 구성된 하드웨어 계층이다. 글에서 설명하는 데이터 흐름도 명확하다. 평문 데이터가 로컬에서 생성되고, 암호화되고, HMAC이 추가된 뒤, IV와 함께 저장되며, 이후 필요할 때 W5500을 통해 TCP 연결로 전송될 수 있다.

메이커 관점에서 중요한 점은 이 설계가 단순한 네트워킹 예제도 아니고, 단순한 암호화 예제도 아니라는 것이다. 제한된 RAM과 클록 속도를 가진 MCU 환경에서, 통신 오프로딩과 로컬 데이터 보호를 실용적으로 분리한 구조라는 점이 핵심이다. 글도 이런 점을 분명히 하며, W5500을 사용하면 네트워킹 부담을 줄여 더 많은 CPU 시간을 AI 또는 애플리케이션 로직에 남길 수 있다고 설명한다.

Where WIZnet Fits

여기서 사용된 정확한 WIZnet 제품은 W5500이다. 이 아키텍처에서 W5500은 보안 엔진이 아니라 유선 전송 엔진 역할을 한다. 즉, 이더넷 연결, TCP 소켓 설정, 링크 유지 관리를 담당해 MCU가 전체 소프트웨어 TCP/IP 스택을 직접 돌리지 않아도 되게 한다. 글에 나온 초기화 예제는 setSHAR, setSIPR, setSUBR, setGAR, setPHYCFGR, socket, connect 같은 W5500 레지스터 호출을 사용하고 있어, 시스템 내 역할이 분명하다.

이 분리는 소형 보드에서 특히 중요하다. 글은 W5500이 소프트웨어 스택 기반 접근보다 CPU 부담을 줄여준다고 주장하며, 이를 통해 MCU 자원을 애플리케이션 작업에 더 많이 남겨둘 수 있다고 설명한다. 다만 글에는 8개 소켓 지원, 소켓당 8 KB 캐시, 10% 미만 CPU 사용률, 70 MHz SPI에서 80 Mbps 수준 처리량 같은 수치도 제시되지만, 별도의 측정 방법이나 벤치마크 근거는 함께 제공되지 않는다. 따라서 이런 수치는 독립적으로 검증된 성능 수치라기보다 글에서 제시한 주장으로 보는 편이 맞다.

메이커용 엣지 디바이스 관점에서 W5500은 예측 가능한 유선 네트워킹과 깔끔한 소프트웨어 경계가 중요할 때 잘 맞는다. MCU는 키 관리, 암호화 흐름, HMAC 검증, 플래시 기록을 담당하고, W5500은 네트워크 측을 전체 소프트웨어 스택이 아니라 소켓 중심 제어 모델에 가깝게 유지해준다. 이 역할 분리가 이 프로젝트의 핵심 아키텍처 가치다.

Implementation Notes

이 프로젝트는 실제로 WIZnet 제품을 사용하며, 글 안에 코드 조각도 보인다. 다만 공개 저장소나 파일 경로, 줄 번호가 있는 소스는 제공되지 않는다. 따라서 저장소 기반 코드 검증은 할 수 없고, 아래 설명은 글 안에서 명시적으로 확인 가능한 내용만 기준으로 한다.

첫 번째로 보이는 구현 요소는 W5500 초기화 루틴이다.

void W5500_Init(void) { ... setSHAR(mac); setSIPR(ip); setSUBR(sn); setGAR(gw); setPHYCFGR(PHYCFGR_DEFAULT); socket(0, Sn_MR_TCP, 5000, 0); connect(0, remote_ip, 5001); }

이 코드가 중요한 이유는 전송 경계를 매우 명확하게 보여주기 때문이다. MCU는 SPI를 초기화하고, W5500을 리셋하고, MAC 및 IPv4 설정을 기록하고, PHY 자동 협상을 활성화한 뒤, W5500을 통해 TCP 소켓을 연다. 즉, 시스템의 네트워크 측은 이 루틴으로 정리되고, 전체 보안 워크플로를 지배하지 않으면서 이를 지원하는 역할을 한다.

두 번째로 보이는 구현 요소는 로컬 암호화 래퍼다.

int encrypt_data(const uint8_t *plain, int len, uint8_t *cipher) { aes_set_key(&aes_ctx, key, 256); return aes_crypt_cbc(&aes_ctx, AES_ENCRYPT, len, iv, plain, cipher); }

이 코드가 중요한 이유는 이 프로젝트의 보안 모델이 W5500 내부 보안이 아니라, W5500 기반 전송 위에 얹힌 애플리케이션 계층 암호화와 무결성 검증이라는 점을 확인해주기 때문이다. W5500은 데이터를 움직이고, MCU 쪽 보안 계층은 저장될 데이터와 이후 전송될 수 있는 데이터를 보호한다.

글은 더 상위 수준의 저장 경로도 설명한다. 애플리케이션이 데이터를 생성하고, 이를 암호화하고, HMAC으로 서명한 뒤, IV와 무결성 메타데이터와 함께 외부 플래시에 기록한다. 부팅 시에는 HMAC 검증을 다시 수행하고, 검증이 실패하면 디바이스를 잠금 상태로 전환한다. 이것이 이 시스템의 핵심 동작이며, W5500이 단독 네트워크 기능이 아니라 암호화 구조와 함께 제시되는 이유이기도 하다.

Practical Tips / Pitfalls

W5500 자체를 보안 기능으로 보면 안 된다. 이 설계에서 W5500은 이더넷 전송만 담당하고, AES, HMAC, 키 처리는 모두 칩 외부에서 구현된다.

글에 나온 성능 수치는 주의해서 봐야 한다. CPU 점유율과 처리량에 대해 강한 주장이 있지만, 벤치마크 조건이나 측정 데이터는 제시되지 않는다.

암호화 키를 일반 펌웨어 플래시에 하드코딩하면 안 된다. 글도 이를 명시적으로 경고하며, 디바이스별 키 주입이나 MCU 고유 ID 기반 파생 방식을 권장한다.

CBC 모드에서는 IV를 재사용하면 안 된다. 글도 각 암호화 연산마다 IV는 서로 달라야 하고 예측 불가능해야 한다고 설명한다.

암호문을 저장할 때 플래시 기록은 원자적으로 처리하는 편이 좋다. 글은 전원 장애로 일부만 기록된 암호문이 남지 않도록 임시 페이지 기록과 포인터 전환을 권장한다.

저장 데이터를 신뢰하기 전에 반드시 무결성을 검증해야 한다. 글의 부팅 시 HMAC 검증과 실패 시 잠금 동작은 중요한데, 암호화만으로는 변조를 막을 수 없기 때문이다.

FAQ

왜 이 프로젝트에서 W5500을 사용하는가?
이 프로젝트는 이미 암호화, 무결성 검증, 로컬 저장 처리로 바쁜 소형 MCU에서 유선 TCP/IP 연결도 함께 처리해야 한다. W5500은 네트워크 처리를 단순하고 하드웨어 보조 방식으로 유지해주므로, MCU가 애플리케이션과 보안 기능에 더 많은 시간을 쓸 수 있게 해준다.

플랫폼과는 어떻게 연결되는가?
글에서는 W5500을 SPI 초기화와 리셋 이후, MAC 주소, IP 주소, 서브넷 마스크, 게이트웨이, PHY 설정, 소켓 설정을 위한 레지스터 수준 구성으로 구동하는 모습을 보여준다. 즉, 플랫폼 인터페이스는 외부 MCU와 SPI 제어 W5500 네트워크 컨트롤러 조합이다.

이 프로젝트에서 W5500의 구체적인 역할은 무엇인가?
보안 로컬 AI 데이터 처리를 위한 통신 계층이다. 디바이스는 W5500으로 TCP 연결을 유지하고, MCU는 로컬 레코드를 암호화하고, HMAC 서명을 계산하고, 암호문을 플래시에 저장하며, 이후 보호된 데이터를 필요 시 전송한다.

초보자도 따라갈 수 있는가?
가능하지만 SPI 주변장치, TCP 소켓 기본 개념, 기초적인 암호화 개념을 이미 알고 있는 메이커에게 더 적합하다. 네트워킹 측은 W5500 덕분에 비교적 접근하기 쉽지만, 전체 프로젝트를 제대로 구현하려면 키, IV, 저장 무결성을 신중히 다뤄야 한다.

LwIP와 비교하면 어떤 차이가 있는가?
글은 W5500을 소형 MCU에서 더 낮은 오버헤드의 대안으로 제시한다. 다만 직접적인 비교 측정치는 제공하지 않는다. 따라서 방어 가능한 비교는 구조 수준이다. LwIP는 더 큰 소프트웨어 유연성을 제공하지만, W5500은 스택 부담을 줄이고 펌웨어를 레지스터 설정과 소켓 동작 중심으로 단순화한다.

Source

원문 출처: CSDN 글 “W5500以太网接入实现小智AI本地数据加密存储安全架构.”
페이지에는 CC 4.0 BY-SA가 표시되어 있으며, MCU급 AI 엣지 디바이스를 위한 W5500 기반 로컬 암호화 및 저장 아키텍처를 설명한다.

Tags

W5500, WIZnet, Embedded Ethernet, Secure Storage, AES, HMAC, Edge AI, Maker, TCP Socket, SPI Flash, Local Data Protection, MCU Security

 
 
Documents
Comments Write