daikin-altherma-esp32
ESP32-S3 firmware bridging a Daikin Altherma heat pump to MQTT
0
Project description

Daikin Altherma โ MQTT Bridge โ One Cable Into the Cellar, One Register to Find It
#W5500 #MACRAW #ESP32S3 #PoE #RuntimeDetection #ESP-IDF #MQTT #HomeAssistant #HeatPump #ModbusTCP #OTA
๐ Context: Open-source home-automation firmware (MIT, v1.0.0, 451 commits) โ a single-developer project with an unusually disciplined engineering culture: host-tested pure logic, source-text contract tests in CI, and a documentation set that states why every decision was made.
Implementation status: Fully implemented and running. The X10A protocol is validated against live bus captures; the W5500 wired transport is a complete bring-up path with runtime detection, failure unwind, and a cable-loss recovery policy โ all of it host-tested and pinned by CI contract tests.
01 โ What is this project?
A Daikin Altherma heat pump knows a great deal about itself โ flow temperatures, compressor state, defrost cycles, hot-water tank behaviour โ and shares almost none of it. The X10A service header on the indoor unit's PCB is the one place those numbers surface: a 5 V TTL UART at 9600 8E1, half-duplex, poll-only. The unit never volunteers a value; it answers a query and goes quiet.
daikin-altherma-esp32 is ESP-IDF firmware for the ESP32-S3 that taps X10A, decodes both protocol variants (I and S), converts the raw register pages into a labelled value catalog, and publishes everything to MQTT with Home Assistant discovery. Around that core it builds what a device left alone in a utility room for years actually needs:
- an embedded web UI โ one live dashboard, with any reading the firmware cannot currently stand behind shown as
โrather than as a number - signed dual-slot OTA (two ~2.03 MB slots) and a browser Web Serial installer
- a 4 MiB wear-levelled history journal in the upper flash โ a circular append-only ring of 256-byte records, CRC'd, with a separate commit word programmed last so a power cut cannot invalidate its predecessors
- an optional second data source: a Daikin HomeHub read over Modbus TCP, discovered by mDNS
- an optional ENV III outdoor climate sensor over IยฒC
- a 24-hour plant checkup that turns the trend journal into plain-language diagnostics
The firmware is read-only by construction. X10A has no write command in the protocol, and the Modbus link has none in the code โ no source file can even frame a Modbus write, and a CI contract test walks every file under main/ to keep it that way.
Then comes the problem that has nothing to do with heat pumps and everything to do with buildings: the machine is in the cellar, and the Wi-Fi is not. A heat pump lives in a utility room, behind concrete, at the far end of the house from the access point. A telemetry bridge that drops off the network every evening is not a telemetry bridge.
The answer is an optional wired transport built on the WIZnet W5500 โ in practice an M5Stack AtomS3 Lite seated on an ATOMIC PoE Base, where one cable carries both the power and the LAN. And the way that transport is engineered is what makes this project worth reading.
02 โ Why a wire, and why it had to be optional
๐ท Reason 1 โ Radio does not reach where heat pumps live
Concrete, plant rooms, cellars, outbuildings. This is the classic case where an installer has a network cable or a PoE switch available and no realistic Wi-Fi path. PoE closes it completely: no outlet needed beside the unit, no repeater, no powerline adapter โ one cable, one run, done.
๐ท Reason 2 โ The radio is expensive on a board this small
Starting the Wi-Fi station costs roughly 50 KB of heap on a device whose real binding constraint is the largest contiguous free block. A board that comes up wired never starts the radio at all, and never puts a second netif on the same subnet for nothing.
๐ท Reason 3 โ But it could not become a second firmware
CI publishes exactly one esp32s3 image. A compile-time board choice would fork the binary, its OTA manifest and the web installer โ three artefacts, per board, forever. So the wired transport had to be something the same image discovers at runtime. That constraint is what drives the whole W5500 design below.
๐ท WIZnet ecosystem context โ why this is not an "either/or" against the internal MAC
Worth stating plainly, because it decides the whole design space: the ESP32-S3 has no internal Ethernet MAC. The original ESP32's EMAC peripheral did not carry forward, so the familiar "RMII + external PHY (LAN8720 / LAN8742A)" route is not merely inconvenient on this chip โ it does not exist. Every wired ESP32-S3 is an SPI Ethernet controller, and that is exactly the slot the W5500 fills.
| Option | On ESP32-S3 | Verdict |
|---|---|---|
| Internal EMAC + RMII PHY | Not available โ no EMAC peripheral on S3 | Ruled out by silicon |
| ENC28J60 over SPI | 10 Mbps half-duplex, 8 KB buffer, long errata history | Workable, materially weaker |
| WIZnet W5500 over SPI | 10/100 auto-negotiating MAC+PHY, 32 KB internal buffer, first-class ESP-IDF driver | Chosen |
Within WIZnet's own line the same slot is served by the W5100S and by the W6100 (which adds IPv6 dual-stack), and the W55RP20 folds an RP2040 alongside the same core for a single-package solution. For this project the W5500 is the right member of the family: it is the part the M5Stack ATOMIC PoE Base already carries, and the part with a maintained Espressif-published driver component (espressif/w5500).
03 โ System architecture

The OTA path, over whichever transport is carrying the device

Separate failure class โ BOOT-LOOP SAFE MODE (logic/boot_guard.hpp): both slots share one NVS, so rolling back the IMAGE cannot fix a CONFIG crash-loop (wrong X10A RX/TX pins). Crash-only boots are counted; past a threshold the device comes up minimally โ WiFi + web UI + OTA, no poll, no MQTT โ so the bad setting is fixable in a browser instead of over USB. Second install path โ BROWSER WEB SERIAL: the manifest publishes only the occupied flash_args ranges as separate parts, so a no-Erase install skips nvs. "Erase" stays the explicit factory-reset path.
04 โ Why the WIZnet W5500? โญ
๐ท The technical core: a whole Ethernet front end behind four wires
The W5500 is a 10/100 auto-negotiating MAC and PHY in one package, driven entirely over SPI. On an ESP32-S3 that is not a convenience โ it is the only shape wired Ethernet can take, because the chip has no EMAC to pair a PHY with. Four pads (SCLK 5 ยท CS 6 ยท MISO 7 ยท MOSI 8), SPI mode 0 at 20 MHz, and the board is on the LAN.
Crucially, four pads is few enough that the trade stays survivable. On an AtomS3 Lite the PoE base occupies the entire side header โ and the Grove port that remains is exactly what X10A needs. The heat pump link and the network link coexist on a 24 ร 24 mm board because the Ethernet controller asked for four pins instead of the fourteen an RMII PHY would have wanted.
๐ท The mode: MACRAW (Sn_MR = 0x04) โ and why the TOE is deliberately unused
This is the identity of the integration, so it is worth being precise about it.
The espressif/w5500 component drives the part as a plain Ethernet MAC: socket 0 is placed in MACRAW mode, the full 16 KB RX buffer is assigned to that one socket, and raw Ethernet frames are shuttled across SPI in both directions. TCP, UDP, IP, ARP, DHCP and DNS all happen above it, in lwIP on the ESP32-S3. The W5500's celebrated hardwired TCP/IP stack โ the TOE that makes it the part it is on an 8-bit MCU โ is switched off here on purpose.
That is not a limitation. It is the correct engineering answer to what this firmware actually needs:
| What the firmware needs | Where it comes from |
|---|---|
| TLS for signed HTTPS OTA and the weather feed | mbedTLS on the ESP32-S3 |
| MQTT client with HA discovery, syslog, SNTP | ESP-IDF components over lwIP |
mDNS responder (<hostname>.local) | espressif/mdns over lwIP |
| A captive DNS server, an HTTP server with 36 routes | esp_http_server over lwIP |
| An Ethernet MAC and PHY it does not physically have | W5500 |
A hardware TCP socket cannot carry an mbedTLS session, an MQTT client library or a 36-route HTTP server โ those are stack-resident features the ESP32-S3 already had. What the SoC was missing was the bottom two layers. MACRAW is the mode that supplies exactly that and nothing else, and it is the reason a single W5500 slots under an existing, fully-featured software stack without a line above it changing. net.hpp states the consequence directly: this is a second transport, not a second source โ MQTT, syslog, SNTP, OTA and HTTP all run over the wire unchanged, and the bridge above does not know or care which one carries it.
For makers, that is the takeaway worth carrying away: the W5500 has two distinct careers. On a small MCU with no stack, it is a TOE that gives you sockets for free. On an application SoC that already owns lwIP and mbedTLS, it is a clean SPI-attached MAC+PHY in MACRAW. Same silicon, opposite half of the datasheet.
๐ท One register turns a board variant into a runtime feature
This is the most elegant thing the W5500 does for this project, and it costs a single SPI transaction.
VERSIONR lives at offset 0x0039 of the W5500's Common Register block and reads a fixed 0x04 on every part ever made. The firmware reads exactly that one byte at boot โ three bytes of address phase plus one data byte, a single 4-byte full-duplex transfer:
- Reads
0x04โ a controller is wired to those pads. Bring up the netif, take a lease, and never start the Wi-Fi radio at all. - Reads anything else โ free the SPI bus again. The board is byte-for-byte the Wi-Fi device it was before this code existed: no netif, no driver, no task, no event handler.
A floating MISO reads 0x00 or 0xFF, so there is no realistic false positive. That single deterministic register is what lets CI keep publishing one image for every board โ the wired variant and the wireless variant are the same binary, and the difference is discovered in microseconds at boot rather than declared at compile time. Any part whose identity is guessed from behaviour instead of read from a fixed register could not have carried this design.
๐ท Polled operation, because the base routes no interrupt
The ATOMIC PoE Base carries SCLK, CS, MISO, MOSI and power โ and no interrupt line. So the driver runs with int_gpio_num = -1 and poll_period_ms = 10. This is a supported first-class mode (Espressif ships a CI configuration for exactly it), and the project's own Kconfig help is precise about what the number means: it bounds RX latency, not throughput โ each poll drains everything already queued in the W5500's buffer. A 16 KB on-chip RX buffer is what makes a 10 ms poll interval a comfortable design point instead of a packet-loss budget.
๐ท The details a careful integration gets right
- MAC address: the W5500 carries no MAC of its own, so the firmware supplies one โ
ESP_MAC_ETH, the ESP32-S3's eFuse-derived Ethernet address. Stable across reboots and distinct from the Wi-Fi STA MAC, so the two interfaces can never collide on one LAN. - Route priority: ESP-IDF ships
WIFI_STA_DEFat 100 andETH_DEFat 50, so the wire would lose by default.net.cppraises the Ethernet netif to 128 โ and the code comments are honest that this governs off-link traffic only, since lwIP's on-link routing walksnetif_listregardless. - A probe guard that protects the heat pump: the identity probe drives a clock and a chip-select. The documented AtomS3 Lite alternative puts X10A on GPIO5/6 โ the same pads. So
net_eth_probe_allowed()refuses to probe at all when any of the four overlap the configured X10A / sensor / indicator / button pins. Without it, an unguarded boot probe would clock SPI edges onto a heat pump's live service bus. - Complete failure unwind: a positive probe leaves an SPI bus installed. Every later allocation or start failure reverses all of it in strict reverse order โ driver stop, handler unregister, netif glue delete, driver uninstall, MAC delete, PHY delete, netif destroy, and only then
spi_bus_free()โ because a half-unwound Ethernet attempt would hand the Wi-Fi fallback exactly the heap pressure that killed the wired path. - Cable-loss recovery as a stated policy: a board that came up wired has no radio running and cannot safely grow one from an event handler. So a pulled cable earns a deliberate reboot after ~30 s, which re-runs the same boot fork from scratch. The 24-hour trends survive it. With no Wi-Fi configured it does not reboot at all โ it simply waits for the wire, and takes it back when it returns.
๐ท Verified evidence โ
- โ
VERSIONR = 0x04detection implemented innet.cppand used as the actual boot fork - โ
Pinned dependency
espressif/w5500: "^2.0.0"inmain/idf_component.yml, locked independencies.lock - โ
Pins, clock, poll interval and DHCP window all exposed as Kconfig (
CONFIG_DAIKIN_ETH_*) - โ
Transport policy extracted into IDF-free
logic/net_link.hppand host-tested โ route ownership, boot fork, portal suppression, probe permission, cable-loss recovery - โ
test/test_transport_contract.mjsasserts over source text that the call sites still ask those rules โ including that nothing may callwifi_start_sta()unconditionally again - โ Documented user-visible behaviour: the Connections tile grows an Ethernet row showing negotiated speed, and distinguishes no cable from cable connected, no address
- โ
Turning the transport off (
CONFIG_DAIKIN_ETH_ENABLED=n) reclaims ~40 KB of flash and links no Ethernet code at all
05 โ Key components
๐ WIZnet W5500 โ MACRAW mode (Sn_MR = 0x04), socket 0, full 16 KB RX buffer
The optional wired transport. 10/100 auto-negotiating MAC+PHY over SPI mode 0 at 20 MHz on SCLK 5 ยท CS 6 ยท MISO 7 ยท MOSI 8, polled every 10 ms with no interrupt line. Detected at boot by reading VERSIONR (0x0039) and comparing against the fixed 0x04. TCP/IP is handled by lwIP on the host SoC; the W5500 supplies the two layers the ESP32-S3 does not have in silicon.
๐ฒ ESP32-S3 (M5Stack AtomS3 Lite / Seeed XIAO ESP32-S3)
โฅ 8 MB flash mandatory โ two ~2.03 MB OTA slots below 4 MB and the entire upper 4 MiB reserved for the history journal. No PSRAM used; the heap discipline assumes internal RAM only. Native USB-Serial/JTAG for the browser installer.
๐ M5Stack ATOMIC PoE Base
The W5500 carrier. Power and LAN on one cable, which is the entire point in a cellar. Occupies GPIO 5/6/7/8/38 โ the AtomS3 Lite's whole side header โ which the firmware turns into a stated constraint rather than a discovered one: once a controller is detected, those four pads vanish from every pin picker and a config POST naming one is refused.
๐ฆ espressif/w5500 ^2.0.0 (managed component) ยท ESP-IDF โฅ 6.0
ESP-IDF 6.0 moved the SPI Ethernet chip drivers out of core esp_eth, which now ships only the MAC/PHY framework and the internal EMAC. The W5500 MAC/PHY pair is pulled from the component registry โ the ^2.0.0 line is the one built against the 6.x esp_eth API, which is the project's real IDF floor.
๐ X10A UART tap ยท Daikin HomeHub (Modbus TCP) ยท M5Stack ENV III
The three data sources, all read-only. X10A leads wherever it and the HomeHub report the same quantity; Modbus stays visible as the labelled second reading and covers the fallback when X10A is offline.
06 โ Application scenarios
01. Plant-room and cellar telemetry over PoE
The originating case, and the most transferable one. Any monitored machine that lives where radio does not โ boilers, heat pumps, pumps, compressors, tank levels, sub-meters. One PoE run replaces an outlet, an access point and a repeater.
02. Wired Ethernet on any ESP32-S3 product
Because the S3 has no internal EMAC, this repository is a directly reusable reference for every ESP32-S3 design that needs a cable: pin plan, SPI configuration, polled-mode rationale, MAC assignment, route priority, DHCP deadlines and a complete teardown path. Lift net.cpp and logic/net_link.hpp and most of the work is done.
03. One firmware image across wired and wireless fleet variants
The VERSIONR probe is a pattern, not a detail. Any product shipping both a Wi-Fi SKU and a wired/PoE SKU can use it to keep one binary, one OTA manifest and one installer โ and let the hardware announce itself. This is a meaningful reduction in release-engineering surface for a small manufacturer.
04. Read-only industrial gateways where radio is unavailable or disallowed
The whole architecture โ no write path anywhere, enforced by CI; a trust surface that grants the full API to the wired LAN while withholding it from an open setup radio; syslog, SNTP and signed OTA all transport-agnostic โ is a good template for a monitoring bridge in an environment where wireless is impractical or prohibited.
Conclusion
A heat pump in a cellar needs a cable, and a project that ships one binary cannot afford a board variant. One W5500 register at
0x0039resolves both.
- โ
Full X10A service-port decode (
IandSvariants), validated against live bus captures - โ MQTT with Home Assistant discovery, embedded live web UI, signed dual-slot OTA, browser installer
- โ 4 MiB wear-levelled circular history journal with CRC and a last-programmed commit word
- โ Optional W5500 wired transport in MACRAW mode, giving an ESP32-S3 the MAC+PHY it has no silicon for
- โ
Runtime detection via
VERSIONR = 0x04โ one binary serves wired and wireless boards alike - โ PoE-ready on the M5Stack ATOMIC PoE Base: one cable carries power and LAN into the plant room
- โ Ethernet wins the default route (netif priority 128) and suppresses both the Wi-Fi station and the captive portal, saving ~50 KB of heap on a wired boot
- โ Probe guard that refuses to clock SPI onto a configured X10A service bus
- โ Complete reverse-order failure unwind so a failed wired bring-up never poisons the Wi-Fi fallback
- โ Transport policy extracted into host-tested pure logic and pinned by source-text CI contract tests
Q&A
Q. If the W5500's whole selling point is its hardwired TCP/IP stack, why run it in MACRAW and throw that away? Because the ESP32-S3 already owns a full network stack โ lwIP, mbedTLS, an MQTT client, an mDNS responder, an HTTP server with 36 routes. What it does not own is an Ethernet MAC or PHY; the S3 dropped the original ESP32's EMAC peripheral entirely. MACRAW supplies precisely the missing bottom two layers and leaves everything above untouched, which is why the wire slid in under an existing firmware without a single line of the MQTT bridge changing. On a small MCU with no stack, the same chip would rightly be used the opposite way, in TOE mode.
Q. What does MACRAW mode actually cost compared with TOE? Every frame crosses SPI and the host CPU runs the protocol stack, so it costs SPI bandwidth and CPU cycles that TOE would have absorbed. For a telemetry bridge polling a 9600-baud serial bus and publishing a few dozen MQTT values, that cost is invisible โ and the 16 KB on-chip RX buffer absorbs bursts between polls, which is exactly why a 10 ms polling interval works with no interrupt line at all.
Q. Why poll instead of using the W5500's interrupt output? The M5Stack ATOMIC PoE Base routes SCLK, CS, MISO, MOSI and power โ there is no INT pin to wire. Polled operation is a supported ESP-IDF configuration rather than a workaround, and the poll interval bounds latency, not throughput: each poll drains whatever the W5500 has already buffered.
Q. How can the same binary serve a board with Ethernet and a board without? VERSIONR at 0x0039 reads a fixed 0x04 on every W5500, and a floating MISO reads 0x00 or 0xFF. One 4-byte SPI transfer at boot therefore distinguishes "a controller is wired here" from "these pads are empty" with no realistic false positive. Found โ bring up the wire and skip the radio. Not found โ free the SPI bus and behave exactly as a Wi-Fi-only build.
Q. Which W5500 pins does it use, and what does that cost? SCLK 5 ยท CS 6 ยท MISO 7 ยท MOSI 8, all Kconfig-settable. On an AtomS3 Lite the PoE base covers the entire side header, so X10A must use the Grove port โ which means an Ethernet install has no pins left for the optional ENV III sensor. The firmware states that conflict up front instead of letting the user discover it. On a Seeed XIAO ESP32-S3 the same four pads are broken out with room to spare, so a hand-wired W5500 module leaves pins for both X10A and ENV III.
Q. Could a WIZnet part make this design better rather than merely possible? Two directions are worth noting. A W6100 in the same SPI slot would add IPv6 dual-stack for networks that need it. And on a fresh design, a W55RP20 would collapse the controller and an RP2040 into one package โ attractive for a purpose-built PoE telemetry node where the ESP32-S3's Wi-Fi is no longer the point.
Related work โ ESP32-S3 + WIZnet: Update Your App Over Wi-Fi or Ethernet
Both projects put an ESP32-S3 on a WIZnet controller and both take OTA seriously โ but they place the update logic on opposite sides of the app boundary, which is the only comparison worth making here.
| At the OTA level | This project | The WIZnet OTA bootloader |
|---|---|---|
| Where the update logic lives | Inside the app image | In a factory partition that is never overwritten |
| App's own OTA code | Required in every build, forever | None โ the example app is 80 lines with zero networking |
| An image that forgets OTA | Unrecoverable without USB | Installs and runs fine |
| Trigger | App polls a signed HTTPS manifest | BOOT button, empty otadata, or the app asks |
| Downtime | None โ the app keeps running through the download | Reboot โ loader โ download โ reboot |
| Image authenticity | RSA-3072 signature verified before boot-slot selection, plus a two-point downgrade gate | Transport-level HTTPS, certificate pinned in factory |
| Failure recovery | Armed rollback + a connectivity-proving health gate | BOOT button pulls a fresh image off the network |
| Interface | One transport per boot โ the wire wins and the radio never starts | Ethernet and Wi-Fi up simultaneously, with different jobs |
The trade reads cleanly in both directions. Keeping OTA inside the app is what lets this firmware cooperate with its own update โ leasing heap, standing the MQTT publisher and X10A poller aside, quiescing an in-flight weather request. Moving OTA into a factory partition makes that cooperation impossible and simultaneously unnecessary, because the app is already stopped โ and it removes the one failure this project cannot defend against: a healthy image that boots, proves connectivity, seals itself in, and can never update again.
๋ค์ดํจ ์ํ ๋ฅด๋ง โ MQTT ๋ธ๋ฆฌ์ง โ ์งํ์ค๊น์ง ๋ค์ด๊ฐ๋ ์ผ์ด๋ธ ํ ๊ฐ๋ฅ, ๊ทธ๊ฑธ ์ฐพ์๋ด๋ ๋ ์ง์คํฐ ํ๋
#W5500 #MACRAW #ESP32S3 #PoE #๋ฐํ์๊ฐ์ง #ESP-IDF #MQTT #HomeAssistant #ํํธํํ #ModbusTCP #OTA
๐ ๋ฐฐ๊ฒฝ: ์คํ์์ค ํ์คํ ๋ฉ์ด์ ํ์จ์ด (MIT, v1.0.0, 451 ์ปค๋ฐ). 1์ธ ๊ฐ๋ฐ ํ๋ก์ ํธ์น๊ณ ์์ง๋์ด๋ง ๊ท์จ์ด ๋๋จํ ๋จ๋จํ๋ค โ ์์ ๋ก์ง์ ํธ์คํธ์์ ํ ์คํธํ๊ณ , CI๊ฐ ์์ค ํ ์คํธ ์์ฒด๋ฅผ ๋์์ผ๋ก ๊ณ์ฝ ํ ์คํธ๋ฅผ ๊ฑธ๋ฉฐ, ๋ฌธ์๊ฐ ๋ชจ๋ ๊ฒฐ์ ์ ์ด์ ๋ฅผ ๋ช ์ํ๋ค.
๊ตฌํ ์ํ: ์์ ๊ตฌํ ๋ฐ ์ค๋์. X10A ํ๋กํ ์ฝ์ ์ค์ ๋ฒ์ค ์บก์ฒ๋ก ๊ฒ์ฆ๋์๊ณ , W5500 ์ ์ ์ ์ก ๊ฒฝ๋ก๋ ๋ฐํ์ ๊ฐ์ง ยท ์คํจ ์ ์์ ๋๊ฐ๊ธฐ ยท ์ผ์ด๋ธ ๋ถ๋ฆฌ ๋ณต๊ตฌ ์ ์ฑ ๊น์ง ๊ฐ์ถ ์๊ฒฐ๋ ๋ธ๋ง์ ์ฝ๋๋ค. ๊ทธ๋ฆฌ๊ณ ๊ทธ ์ ๋ถ๊ฐ ํธ์คํธ ํ ์คํธ์ CI ๊ณ์ฝ ํ ์คํธ๋ก ๊ณ ์ ๋์ด ์๋ค.
01 โ ์ด ํ๋ก์ ํธ๋ ๋ฌด์์ธ๊ฐ?
๋ค์ดํจ ์ํ ๋ฅด๋ง ํํธํํ๋ ์๊ธฐ ์์ ์ ๋ํด ์์ฃผ ๋ง์ ๊ฒ์ ์๊ณ ์๋ค. ์ ๋ ์จ๋, ์ปดํ๋ ์ ์ํ, ์ ์ ์ฌ์ดํด, ์จ์ ํฑํฌ ๊ฑฐ๋๊น์ง. ๊ทธ๋ฐ๋ฐ ๊ทธ์ค ๋ฐ์ผ๋ก ๋ด์ฃผ๋ ๊ฑด ๊ฑฐ์ ์๋ค. ๊ทธ ์ซ์๋ค์ด ์ ์ผํ๊ฒ ๋ฐ์ผ๋ก ๋์ค๋ ์ง์ ์ด ์ค๋ด๊ธฐ PCB์ X10A ์๋น์ค ํค๋๋ค. 9600 8E1, 5 V TTL UART, ๋ฐ์ด์ค, ํด๋ง ์ ์ฉ. ์ ๋์ ๊ฐ์ ๋จผ์ ๋ด๋ณด๋ด๋ ๋ฒ์ด ์๊ณ ์ง๋ฌธ์๋ง ๋ตํ ๋ค ์กฐ์ฉํด์ง๋ค.
daikin-altherma-esp32๋ ESP32-S3์ฉ ESP-IDF ํ์จ์ด๋ก, X10A๋ฅผ ํญํด ๋ ๊ฐ์ง ํ๋กํ ์ฝ ๋ณ์ข
(I/S)์ ๋ชจ๋ ๋์ฝ๋ํ๊ณ , ์์ ๋ ์ง์คํฐ ํ์ด์ง๋ฅผ ์ด๋ฆ ๋ถ์ ๊ฐ ์นดํ๋ก๊ทธ๋ก ๋ณํํ ๋ค MQTT + Home Assistant ๋์ค์ปค๋ฒ๋ฆฌ๋ก ์ ๋ถ ํผ๋ธ๋ฆฌ์ํ๋ค. ๊ทธ ์ฝ์ด ์ฃผ๋ณ์๋, ๊ธฐ๊ณ์ค์ ๋ช ๋
์ฉ ๋ฐฉ์น๋ ์ฅ์น๊ฐ ์ค์ ๋ก ํ์๋ก ํ๋ ๊ฒ๋ค์ด ๋ถ์ด ์๋ค.

- ๋ด์ฅ ์น UI โ ๋ผ์ด๋ธ ๋์๋ณด๋ ํ๋. ํ์จ์ด๊ฐ ํ์ฌ ์ฑ
์์ง ์ ์๋ ๊ฐ์ ์ซ์ ๋์
โ๋ก ํ์ํ๋ค - ์๋ช ๋ ๋์ผ ์ฌ๋กฏ OTA (์ฝ 2.03 MB ์ฌ๋กฏ 2๊ฐ)์ ๋ธ๋ผ์ฐ์ Web Serial ์ธ์คํจ๋ฌ
- ์์ ํ๋์์ 4 MiB ์จ์ด ๋ ๋ฒจ๋ง ํ์คํ ๋ฆฌ ์ ๋ โ 256๋ฐ์ดํธ ๋ ์ฝ๋์ ์ํ append-only ๋ง, CRC ์ ์ฉ, ์ปค๋ฐ ์๋๋ฅผ ๋งจ ๋ง์ง๋ง์ ํ๋ก๊ทธ๋๋ฐํด์ ์ ์ ์ด ์์ ๋ ์ฝ๋๋ค์ ๋ฌดํจํํ์ง ๋ชปํ๊ฒ ํ๋ค
- ์ ํ์ 2์ฐจ ๋ฐ์ดํฐ ์์ค: mDNS๋ก ๋ฐ๊ฒฌํ๋ ๋ค์ดํจ HomeHub๋ฅผ Modbus TCP๋ก ์ฝ์
- ์ ํ์ ENV III ์ธ๊ธฐ ํ๊ฒฝ ์ผ์ (IยฒC)
- ํธ๋ ๋ ์ ๋์ ํ๋ฌธ ์ง๋จ์ผ๋ก ๋ฐ๊ฟ์ฃผ๋ 24์๊ฐ ํ๋ํธ ์ฒดํฌ์
์ด ํ์จ์ด๋ ๊ตฌ์กฐ์ ์ผ๋ก ์ฝ๊ธฐ ์ ์ฉ์ด๋ค. X10A ํ๋กํ ์ฝ์ ์ฐ๊ธฐ ๋ช
๋ น ์์ฒด๊ฐ ์๊ณ , Modbus ๋งํฌ๋ ์ฝ๋์ ์ฐ๊ธฐ ๊ฒฝ๋ก๊ฐ ์๋ค โ ์ด๋ ์์ค ํ์ผ๋ Modbus ์ฐ๊ธฐ ํ๋ ์์ ๋ง๋ค ์์กฐ์ฐจ ์์ผ๋ฉฐ, CI ๊ณ์ฝ ํ
์คํธ๊ฐ main/ ์๋ ๋ชจ๋ ํ์ผ์ ํ์ด ๊ทธ ์ํ๋ฅผ ์ ์ง์ํจ๋ค.
๊ทธ๋ฆฌ๊ณ ํํธํํ์๋ ์๋ฌด ์๊ด ์๊ณ ๊ฑด๋ฌผ๊ณผ๋ ์ ์ ์ผ๋ก ์๊ด์๋ ๋ฌธ์ ๊ฐ ๋ฑ์ฅํ๋ค. ๊ธฐ๊ณ๋ ์งํ์ค์ ์๊ณ , ์์ดํ์ด๋ ์๋ค. ํํธํํ๋ ๊ธฐ๊ณ์ค, ์ฝํฌ๋ฆฌํธ ๋ค, AP์์ ๊ฐ์ฅ ๋จผ ์ชฝ์ ์ฐ๋ค. ๋งค์ผ ์ ๋ ๋คํธ์ํฌ์์ ๋จ์ด์ง๋ ํ ๋ ๋ฉํธ๋ฆฌ ๋ธ๋ฆฌ์ง๋ ํ ๋ ๋ฉํธ๋ฆฌ ๋ธ๋ฆฌ์ง๊ฐ ์๋๋ค.
๊ทธ ๋ต์ด WIZnet W5500 ๊ธฐ๋ฐ ์ ํ์ ์ ์ ์ ์ก ๊ฒฝ๋ก๋ค. ์ค๋ฌผ๋ก๋ M5Stack AtomS3 Lite๋ฅผ ATOMIC PoE Base์ ์น์ ํํ์ด๊ณ , ์ผ์ด๋ธ ํ ๊ฐ๋ฅ์ด ์ ์๊ณผ LAN์ ๋์์ ๋๋ฅธ๋ค. ๊ทธ๋ฆฌ๊ณ ๊ทธ ์ ์ก ๊ฒฝ๋ก๊ฐ ์ด๋ป๊ฒ ์ค๊ณ๋์๋์ง๊ฐ ์ด ํ๋ก์ ํธ๋ฅผ ์ฝ์ ๊ฐ์น๊ฐ ์๊ฒ ๋ง๋ ๋ค.
02 โ ์ ์ ์ ์ด์ด์ผ ํ๊ณ , ์ ์ ํ์ ์ด์ด์ผ ํ๋
๐ท ์ด์ 1 โ ํํธํํ๊ฐ ์ฌ๋ ๊ณณ๊น์ง ์ ํ๊ฐ ์ ๊ฐ๋ค
์ฝํฌ๋ฆฌํธ, ๊ธฐ๊ณ์ค, ์งํ์ค, ๋ณ๋. ์ค์น์์๊ฒ ๋์ ์ด๋ PoE ์ค์์น๋ ์๋๋ฐ ํ์ค์ ์ธ ์์ดํ์ด ๊ฒฝ๋ก๋ ์๋ ์ ํ์ ์ธ ์ํฉ์ด๋ค. PoE๋ ์ด๊ฑธ ์์ ํ ๋ซ๋๋ค: ์ ๋ ์์ ์ฝ์ผํธ๋, ์ค๊ณ๊ธฐ๋, ์ ๋ ฅ์ ์ด๋ํฐ๋ ํ์ ์๋ค. ํ ๊ฐ๋ฅ, ํ ๋ฒ์ ๋ฐฐ์ ์ผ๋ก ๋.
๐ท ์ด์ 2 โ ์ด ์ ๋ ๋ณด๋์์ ๋ผ๋์ค๋ ๋น์ธ๋ค
์์ดํ์ด ์คํ ์ด์ ์ ์ฌ๋ฆฌ๋ฉด ํ์ด ๋๋ต 50 KB ๋๊ฐ๋ค. ๊ทธ๋ฐ๋ฐ ์ด ์ฅ์น์ ์ค์ง์ ์ ์ฝ์ ์ ์ฒด ์ฌ์ ํ์ด ์๋๋ผ ๊ฐ์ฅ ํฐ ์ฐ์ ๋ธ๋ก์ด๋ค. ์ ์ ์ผ๋ก ๋ถํ ํ ๋ณด๋๋ ๋ผ๋์ค๋ฅผ ์์ ์์ํ์ง ์๊ณ , ๊ฐ์ ์๋ธ๋ท์ ๋ ๋ฒ์งธ netif๋ฅผ ๊ณต์ง๋ก ์น์ง๋ ์๋๋ค.
๐ท ์ด์ 3 โ ๊ทธ๋ ๋ค๊ณ ๋ ๋ฒ์งธ ํ์จ์ด๊ฐ ๋ ์๋ ์์๋ค
CI๋ ์ ํํ esp32s3 ์ด๋ฏธ์ง ํ๋๋ง ๋ฐฐํฌํ๋ค. ์ปดํ์ผ ํ์ ๋ณด๋ ์ ํ์ผ๋ก ๋ง๋ค๋ฉด ๋ฐ์ด๋๋ฆฌยทOTA ๋งค๋ํ์คํธยท์น ์ธ์คํจ๋ฌ๊ฐ ๋ณด๋๋ง๋ค ๊ฐ๋ผ์ง๋ค. ์ฐ์ถ๋ฌผ ์ธ ์ข
๋ฅ๊ฐ ๋ณด๋ ์๋งํผ, ์์ํ. ๊ทธ๋์ ์ ์ ์ ์ก ๊ฒฝ๋ก๋ ๊ฐ์ ์ด๋ฏธ์ง๊ฐ ๋ฐํ์์ ๋ฐ๊ฒฌํ๋ ๋ฌด์ธ๊ฐ์ฌ์ผ๋ง ํ๋ค. ์๋ W5500 ์ค๊ณ ์ ์ฒด๋ฅผ ๋๊ณ ๊ฐ๋ ๊ฒ ๋ฐ๋ก ์ด ์ ์ฝ์ด๋ค.
๐ท WIZnet ์ํ๊ณ ๊ด์ โ ๋ด์ฅ MAC๊ณผ์ "๋ ์ค ํ๋" ๋ฌธ์ ๊ฐ ์๋๋ค
์ค๊ณ ๊ณต๊ฐ ์์ฒด๋ฅผ ๊ฒฐ์ ํ๋ ์ฌ์ค์ด๋ผ ๋ถ๋ช ํ ์ง๊ณ ๊ฐ๋ค. ESP32-S3์๋ ๋ด์ฅ ์ด๋๋ท MAC์ด ์๋ค. ์ด๊ธฐ ESP32์ EMAC ํ๋ฆฌํ๋ด์ด S3๋ก ๋์ด์ค์ง ์์๊ธฐ ๋๋ฌธ์, ์ต์ํ "RMII + ์ธ๋ถ PHY(LAN8720 / LAN8742A)" ๊ฒฝ๋ก๋ ์ด ์นฉ์์ ๋ถํธํ ์ ๋๊ฐ ์๋๋ผ ์์ ์กด์ฌํ์ง ์๋๋ค. ESP32-S3์ ์ ์ ์ ์ ๋ถ SPI ์ด๋๋ท ์ปจํธ๋กค๋ฌ์ด๊ณ , ๊ทธ ์๋ฆฌ๊ฐ ์ ํํ W5500์ ์๋ฆฌ๋ค.
| ์ ํ์ง | ESP32-S3์์ | ๊ฒฐ๋ก |
|---|---|---|
| ๋ด์ฅ EMAC + RMII PHY | ๋ถ๊ฐ โ S3์ EMAC ํ๋ฆฌํ๋ด ์์ | ์ค๋ฆฌ์ฝ ๋ ๋ฒจ์์ ํ๋ฝ |
| ENC28J60 (SPI) | 10 Mbps ๋ฐ์ด์ค, 8 KB ๋ฒํผ, ๊ธด errata ์ด๋ ฅ | ๊ฐ๋ฅํ์ง๋ง ๋ช ๋ฐฑํ ์ด์ธ |
| WIZnet W5500 (SPI) | 10/100 ์คํ ๋ค๊ณ MAC+PHY, 32 KB ๋ด๋ถ ๋ฒํผ, 1๊ธ ESP-IDF ๋๋ผ์ด๋ฒ | ์ฑํ |
WIZnet ๋ผ์ธ์
๋ด์์ ๊ฐ์ ์๋ฆฌ๋ W5100S์ W6100(IPv6 ๋์ผ์คํ ์ถ๊ฐ)์ด ํจ๊ป ์ฑ์ฐ๊ณ , W55RP20์ ๊ฐ์ ์ฝ์ด์ RP2040์ ํฉ์ณ ๋จ์ผ ํจํค์ง ํด๋ฒ์ ๋ง๋ ๋ค. ์ด ํ๋ก์ ํธ์๋ W5500์ด ํจ๋ฐ๋ฆฌ ์ค ๋ง๋ ๋ฉค๋ฒ๋ค. M5Stack ATOMIC PoE Base๊ฐ ์ด๋ฏธ ์ฃ๊ณ ์๋ ๋ถํ์ด๊ณ , Espressif๊ฐ ์ง์ ๋ฐฐํฌยท์ ์งํ๋ ๋๋ผ์ด๋ฒ ์ปดํฌ๋ํธ(espressif/w5500)๊ฐ ์๋ ๋ถํ์ด๊ธฐ ๋๋ฌธ์ด๋ค.
03 โ ์์คํ ์ํคํ ์ฒ


04 โ ์ WIZnet W5500์ธ๊ฐ? โญ
๐ท ๊ธฐ์ ์ ํต์ฌ: ์ ๋ค ๊ฐ๋ฅ ๋ค์ ์ด๋๋ท ํ๋ฐํธ์๋ ์ ์ฒด
W5500์ 10/100 ์คํ ๋ค๊ณ MAC๊ณผ PHY๊ฐ ํ ํจํค์ง์ ๋ค์ด๊ฐ ๋ถํ์ด๊ณ , ์ ๋ถ SPI๋ก ์ ์ด๋๋ค. ESP32-S3์์ ์ด๊ฑด ํธ์๊ฐ ์๋๋ผ ์ ์ ์ด๋๋ท์ด ์ทจํ ์ ์๋ ์ ์ผํ ํํ๋ค. PHY๋ฅผ ๋ถ์ผ EMAC ์์ฒด๊ฐ ์นฉ์ ์๊ธฐ ๋๋ฌธ์ด๋ค. ํจ๋ ๋ค ๊ฐ(SCLK 5 ยท CS 6 ยท MISO 7 ยท MOSI 8), SPI mode 0 ยท 20 MHz๋ฉด ๋ณด๋๊ฐ LAN์ ์ฌ๋ผ๊ฐ๋ค.
์ค์ํ ๊ฑด ๋ค ๊ฐ๊ฐ ํธ๋ ์ด๋๊ฐ ๊ฐ๋น ๊ฐ๋ฅํ ๋งํผ ์ ๋ค๋ ์ ์ด๋ค. AtomS3 Lite์์ PoE ๋ฒ ์ด์ค๋ ์ฌ์ด๋ ํค๋ ์ ์ฒด๋ฅผ ์ ์ ํ๋๋ฐ, ๋จ๋ Grove ํฌํธ๊ฐ ์ ํํ X10A๊ฐ ํ์๋ก ํ๋ ์๋ฆฌ๋ค. 24 ร 24 mm ๋ณด๋์์ ํํธํํ ๋งํฌ์ ๋คํธ์ํฌ ๋งํฌ๊ฐ ๊ณต์กดํ ์ ์๋ ์ด์ ๋, ์ด๋๋ท ์ปจํธ๋กค๋ฌ๊ฐ RMII PHY๋ผ๋ฉด ์๊ตฌํ์ 14๊ฐ ๋์ 4๊ฐ๋ง ์๊ตฌํ๊ธฐ ๋๋ฌธ์ด๋ค.
๐ท ์ฌ์ฉ ๋ชจ๋: MACRAW (Sn_MR = 0x04) โ ๊ทธ๋ฆฌ๊ณ TOE๋ฅผ ์๋์ ์ผ๋ก ์ฐ์ง ์๋ ์ด์
์ด๊ฒ ์ด ํตํฉ์ ์ ์ฒด์ฑ์ด๋ฏ๋ก ์ ํํ๊ฒ ์ง๋๋ค.
espressif/w5500 ์ปดํฌ๋ํธ๋ ์ด ๋ถํ์ ์์ ์ด๋๋ท MAC์ผ๋ก ๋ชฌ๋ค. ์์ผ 0์ MACRAW ๋ชจ๋์ ๋๊ณ , 16 KB RX ๋ฒํผ ์ ์ฒด๋ฅผ ๊ทธ ์์ผ ํ๋์ ํ ๋นํ ๋ค, ์ ์ด๋๋ท ํ๋ ์์ SPI๋ก ์๋ฐฉํฅ ์ค์ด ๋๋ฅธ๋ค. TCPยทUDPยทIPยทARPยทDHCPยทDNS๋ ์ ๋ถ ๊ทธ ์, ESP32-S3์ lwIP์์ ์ผ์ด๋๋ค. 8๋นํธ MCU์์ W5500์ W5500๋ต๊ฒ ๋ง๋๋ ๊ทธ ์ ๋ช
ํ ํ๋์์ด์ด๋ TCP/IP ์คํ โ TOE๋ ์ฌ๊ธฐ์ ์๋์ ์ผ๋ก ๊บผ์ ธ ์๋ค.
์ด๊ฑด ํ๊ณ๊ฐ ์๋๋ค. ์ด ํ์จ์ด๊ฐ ์ค์ ๋ก ํ์๋ก ํ๋ ๊ฒ์ ๋ํ ์ ํํ ๊ณตํ์ ๋ต์ด๋ค.
| ํ์จ์ด๊ฐ ํ์๋ก ํ๋ ๊ฒ | ์ด๋์ ์ค๋๊ฐ |
|---|---|
| ์๋ช HTTPS OTA์ ๋ ์จ ํผ๋์ฉ TLS | ESP32-S3์ mbedTLS |
| HA ๋์ค์ปค๋ฒ๋ฆฌ MQTT ํด๋ผ์ด์ธํธ, syslog, SNTP | lwIP ์ ESP-IDF ์ปดํฌ๋ํธ |
mDNS ์๋ต์ (<hostname>.local) | lwIP ์ espressif/mdns |
| ์บกํฐ๋ธ DNS ์๋ฒ, 36๊ฐ ๋ผ์ฐํธ์ HTTP ์๋ฒ | lwIP ์ esp_http_server |
| ๋ฌผ๋ฆฌ์ ์ผ๋ก ์๋ ์ด๋๋ท MAC๊ณผ PHY | W5500 |
ํ๋์จ์ด TCP ์์ผ์ mbedTLS ์ธ์
๋, MQTT ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋, 36๊ฐ ๋ผ์ฐํธ HTTP ์๋ฒ๋ ์ค์ด ๋๋ฅผ ์ ์๋ค. ๊ทธ๊ฒ๋ค์ ์ด๋ฏธ ESP32-S3๊ฐ ๊ฐ์ง ์คํ ์์ฃผ ๊ธฐ๋ฅ์ด๋ค. SoC์ ์๋ ๊ฑด ์๋ ๋ ๊ณ์ธต์ด์๋ค. MACRAW๋ ์ ํํ ๊ทธ๊ฒ๋ง ๊ณต๊ธํ๋ ๋ชจ๋์ด๊ณ , ๊ทธ๋์ W5500 ํ๋๊ฐ ์์ชฝ ์ฝ๋ ํ ์ค๋ ์ ๋ฐ๊พธ๊ณ ๊ธฐ์กด์ ์์ฑ๋ ์ํํธ์จ์ด ์คํ ๋ฐ์ผ๋ก ๋ค์ด๊ฐ ์ ์์๋ค. net.hpp๊ฐ ๊ฒฐ๋ก ์ ์ง์ ์ ์ด๋๋ค โ ์ด๊ฑด 2์ฐจ ์์ค๊ฐ ์๋๋ผ 2์ฐจ ์ ์ก ๊ฒฝ๋ก๋ค. MQTTยทsyslogยทSNTPยทOTAยทHTTP๊ฐ ์ ์ ์์์ ๊ทธ๋๋ก ๋๊ณ , ๊ทธ ์์ ๋ธ๋ฆฌ์ง๋ ์ด๋ ์ชฝ์ด ์๊ธฐ๋ฅผ ๋๋ฅด๋์ง ์์ง๋ ์ ๊ฒฝ ์ฐ์ง๋ ์๋๋ค.
๋ฉ์ด์ปค ์ ์ฅ์์ ๊ฐ์ ธ๊ฐ ๊ตํ์ ์ด๊ฑฐ๋ค. W5500์๋ ์๋ก ๋ค๋ฅธ ๋ ๊ฐ์ ์ปค๋ฆฌ์ด๊ฐ ์๋ค. ์คํ์ด ์๋ ์ํ MCU์์๋ ์์ผ์ ๊ณต์ง๋ก ์ฃผ๋ TOE๋ค. lwIP์ mbedTLS๋ฅผ ์ด๋ฏธ ์์ ํ ์ ํ๋ฆฌ์ผ์ด์ SoC์์๋ MACRAW๋ก ๋๋ ๊น๋ํ SPI ๋ถ์ฐฉํ MAC+PHY๋ค. ๊ฐ์ ์ค๋ฆฌ์ฝ, ๋ฐ์ดํฐ์ํธ์ ๋ฐ๋์ชฝ ์ ๋ฐ.
๐ท ๋ ์ง์คํฐ ํ๋๊ฐ ๋ณด๋ ๋ณ์ข ์ ๋ฐํ์ ๊ธฐ๋ฅ์ผ๋ก ๋ฐ๊พผ๋ค
์ด ํ๋ก์ ํธ์์ W5500์ด ํด์ฃผ๋ ๊ฐ์ฅ ์ฐ์ํ ์ผ์ด๊ณ , ๋น์ฉ์ SPI ํธ๋์ญ์ ํ ๋ฒ์ด๋ค.
VERSIONR์ W5500 Common Register ๋ธ๋ก์ ์คํ์
0x0039์ ์๊ณ , ์ง๊ธ๊น์ง ๋ง๋ค์ด์ง ๋ชจ๋ W5500์์ ๊ณ ์ ๊ฐ 0x04๋ฅผ ์ฝ๋๋ค. ํ์จ์ด๋ ๋ถํ
์ ์ ํํ ๊ทธ ํ ๋ฐ์ดํธ๋ฅผ ์ฝ๋๋ค. ์ฃผ์ ํ์ด์ฆ 3๋ฐ์ดํธ + ๋ฐ์ดํฐ 1๋ฐ์ดํธ, ์ด 4๋ฐ์ดํธ ์ ์ด์ค ์ ์ก ํ ๋ฒ.
0x04๊ฐ ์ฝํ๋ฉด โ ๊ทธ ํจ๋์ ์ปจํธ๋กค๋ฌ๊ฐ ๋ฌผ๋ ค ์๋ค. netif๋ฅผ ์ฌ๋ฆฌ๊ณ lease๋ฅผ ๋ฐ๊ณ , ์์ดํ์ด ๋ผ๋์ค๋ ์์ ์์ํ์ง ์๋๋ค.- ๋ค๋ฅธ ๊ฐ์ด ์ฝํ๋ฉด โ SPI ๋ฒ์ค๋ฅผ ๋ค์ ํด์ ํ๋ค. ๋ณด๋๋ ์ด ์ฝ๋๊ฐ ์๋ ์์ ์ ์์ดํ์ด ์ฅ์น์ ๋ฐ์ดํธ ๋จ์๋ก ๋์ผํด์ง๋ค. netif๋, ๋๋ผ์ด๋ฒ๋, ํ์คํฌ๋, ์ด๋ฒคํธ ํธ๋ค๋ฌ๋ ์๋ค.
MISO๊ฐ ํ๋กํ
์ด๋ฉด 0x00 ๋๋ 0xFF๊ฐ ์ฝํ๋ฏ๋ก ํ์ค์ ์ธ ์คํ์ด ์๋ค. ๊ฒฐ์ ๋ก ์ ์ธ ์ด ๋ ์ง์คํฐ ํ๋ ๋๋ถ์ CI๋ ๋ชจ๋ ๋ณด๋์ ์ด๋ฏธ์ง ํ๋๋ฅผ ๊ณ์ ๋ฐฐํฌํ ์ ์๋ค. ์ ์ ๋ณ์ข
๊ณผ ๋ฌด์ ๋ณ์ข
์ด ๊ฐ์ ๋ฐ์ด๋๋ฆฌ์ด๊ณ , ์ฐจ์ด๋ ์ปดํ์ผ ํ์์ ์ ์ธ๋๋ ๋์ ๋ถํ
์ ๋ง์ดํฌ๋ก์ด ๋จ์๋ก ๋ฐ๊ฒฌ๋๋ค. ๊ณ ์ ๋ ์ง์คํฐ์์ ์ฝ๋ ๋์ ๋์์ผ๋ก ์ ์ฒด๋ฅผ ์ถ์ธกํด์ผ ํ๋ ๋ถํ์ด์๋ค๋ฉด ์ด ์ค๊ณ๋ ์ฑ๋ฆฝํ์ง ๋ชปํ๋ค.
๐ท ํด๋ง ๋์ โ ๋ฒ ์ด์ค๊ฐ ์ธํฐ๋ฝํธ ์ ์ ์ ๋นผ์ฃผ๊ธฐ ๋๋ฌธ์
ATOMIC PoE Base๋ SCLKยทCSยทMISOยทMOSI์ ์ ์๋ง ๋ผ์ฐํ
ํ๋ค. ๋ฐฐ์ ํ INT ํ์ด ์๋ค. ๊ทธ๋์ ๋๋ผ์ด๋ฒ๋ int_gpio_num = -1, poll_period_ms = 10์ผ๋ก ๋๋ค. ์ด๊ฑด ์ฐํ์ฑ
์ด ์๋๋ผ ์ ์ ์ง์ ๋ชจ๋์ด๊ณ (Espressif๊ฐ ์ ํํ ์ด ๊ตฌ์ฑ์ CI ์ค์ ์ ๋ฐฐํฌํ๋ค), ํ๋ก์ ํธ ์์ฒด Kconfig ๋์๋ง์ด ์ซ์์ ์๋ฏธ๋ฅผ ์ ํํ ์ ์ด๋๋ค. ์ด ๊ฐ์ ์ฒ๋ฆฌ๋์ด ์๋๋ผ RX ์ง์ฐ์ ์ ํํ๋ค โ ํด๋ง ํ ๋ฒ๋ง๋ค W5500 ๋ฒํผ์ ์ด๋ฏธ ์์ธ ๊ฑธ ์ ๋ถ ๋น์ด๋ค. ์จ์นฉ 16 KB RX ๋ฒํผ๊ฐ ์๊ธฐ์ 10 ms ํด๋ง์ด ํจํท ์์ค ์์ฐ์ด ์๋๋ผ ์ฌ์ ์๋ ์ค๊ณ์ ์ด ๋๋ค.
๐ท ๊ผผ๊ผผํ ํตํฉ์ด ์ฑ๊ธด ๋ํ ์ผ๋ค
- MAC ์ฃผ์: W5500์ ์๊ธฐ MAC์ด ์์ด์ ํ์จ์ด๊ฐ ๊ณต๊ธํ๋ค. ESP32-S3์ eFuse ๊ธฐ๋ฐ ์ด๋๋ท ์ฃผ์์ธ
ESP_MAC_ETH. ์ฌ๋ถํ ํด๋ ์์ ์ ์ด๊ณ ์์ดํ์ด STA MAC๊ณผ ๊ตฌ๋ถ๋๋ฏ๋ก ๋ ์ธํฐํ์ด์ค๊ฐ ๊ฐ์ LAN์์ ์ถฉ๋ํ ์ ์๋ค. - ๋ผ์ฐํธ ์ฐ์ ์์: ESP-IDF ๊ธฐ๋ณธ๊ฐ์ด
WIFI_STA_DEF100,ETH_DEF50์ด๋ผ ์ ์ ์ด ๊ทธ๋ฅ ๋๋ฉด ์ง๋ค.net.cpp๊ฐ ์ด๋๋ท netif๋ฅผ 128๋ก ์ฌ๋ฆฐ๋ค. ์ฝ๋ ์ฃผ์์ ์ด๊ฒ off-link ํธ๋ํฝ๋ง ์ง๋ฐฐํ๋ค๋ ์ ๊น์ง ์ ์งํ๊ฒ ์ ์ด๋๋ค. lwIP์ on-link ๋ผ์ฐํ ์ ๊ทธ์ ๋ฌด๊ดํ๊ฒnetif_list์์๋ฅผ ๋ฐ๋ฅด๊ธฐ ๋๋ฌธ์ด๋ค. - ํํธํํ๋ฅผ ์งํค๋ ํ๋ก๋ธ ๊ฐ๋: ์๋ณ ํ๋ก๋ธ๋ ํด๋ญ๊ณผ ์นฉ์
๋ ํธ๋ฅผ ๊ตฌ๋ํ๋ค. ๋ฌธ์ํ๋ AtomS3 Lite ๋์ ๋ฐฐ์ ์ X10A๋ฅผ GPIO5/6์ ๋๋๋ฐ, ๊ฐ์ ํจ๋๋ค. ๊ทธ๋์
net_eth_probe_allowed()๋ ๋ค ํจ๋ ์ค ํ๋๋ผ๋ ์ค์ ๋ X10A / ์ผ์ / ์ธ๋์ผ์ดํฐ / ๋ฒํผ ํ๊ณผ ๊ฒน์น๋ฉด ํ๋ก๋ธ ์์ฒด๋ฅผ ๊ฑฐ๋ถํ๋ค. ์ด ๊ฐ๋๊ฐ ์์ผ๋ฉด ๋ถํ ํ๋ก๋ธ๊ฐ ํํธํํ์ ์ด์์๋ ์๋น์ค ๋ฒ์ค์ SPI ์ฃ์ง๋ฅผ ๋๋ ค๋ฃ๋๋ค. - ์์ ํ ์คํจ ๋๊ฐ๊ธฐ: ํ๋ก๋ธ๊ฐ ์ฑ๊ณตํ๋ฉด SPI ๋ฒ์ค๊ฐ ์ค์น๋ ์ํ๋ก ๋จ๋๋ค. ์ดํ ์ด๋ค ํ ๋น/๊ธฐ๋ ์คํจ๋ ์ ๋ถ๋ฅผ ์๊ฒฉํ ์ญ์์ผ๋ก ๋๋๋ฆฐ๋ค โ ๋๋ผ์ด๋ฒ stop, ํธ๋ค๋ฌ ํด์ , netif glue ์ญ์ , ๋๋ผ์ด๋ฒ uninstall, MAC ์ญ์ , PHY ์ญ์ , netif destroy, ๊ทธ๋ค์์์ผ
spi_bus_free(). ๋ฐ์ฏค ๋๊ฐ๊ธด ์ด๋๋ท ์๋๋ ์ ์ ๊ฒฝ๋ก๋ฅผ ์ฃฝ์ธ ๋ฐ๋ก ๊ทธ ํ ์๋ฐ์ ์์ดํ์ด ํด๋ฐฑ์ ๊ทธ๋๋ก ๋ฌผ๋ ค์ฃผ๊ธฐ ๋๋ฌธ์ด๋ค. - ์ผ์ด๋ธ ๋ถ๋ฆฌ ๋ณต๊ตฌ๋ฅผ ์ ์ฑ ์ผ๋ก ๋ช ์: ์ ์ ์ผ๋ก ๋ถํ ํ ๋ณด๋๋ ๋ผ๋์ค๊ฐ ์ ๋๊ณ ์๊ณ , ์ด๋ฒคํธ ํธ๋ค๋ฌ์์ ์์ ํ๊ฒ ๋ผ๋์ค๋ฅผ ํค์ธ ์๋ ์๋ค. ๊ทธ๋์ ์ผ์ด๋ธ์ด ๋ฝํ๋ฉด ์ฝ 30์ด ๋ค ์๋์ ์ผ๋ก ์ฌ๋ถํ ํด ๊ฐ์ ๋ถํธ ๋ถ๊ธฐ๋ฅผ ์ฒ์๋ถํฐ ๋ค์ ํ์ด๋ค. 24์๊ฐ ํธ๋ ๋๋ ์ด์๋จ๋๋ค. ์์ดํ์ด๊ฐ ์์ ์ค์ ๋ผ ์์ง ์์ผ๋ฉด ์ฌ๋ถํ ์กฐ์ฐจ ํ์ง ์๊ณ , ๊ทธ๋ฅ ์ ์ ๊ธฐ๋ค๋ ธ๋ค๊ฐ ๋์์ค๋ฉด ๋ค์ ์ก๋๋ค.
๐ท ๊ฒ์ฆ๋ ์ฆ๊ฑฐ โ
- โ
VERSIONR = 0x04๊ฐ์ง๊ฐnet.cpp์ ๊ตฌํ๋์ด ์ค์ ๋ถํธ ๋ถ๊ธฐ๋ก ์ฌ์ฉ๋จ - โ
main/idf_component.yml์espressif/w5500: "^2.0.0"๊ณ ์ ,dependencies.lock์ผ๋ก ์ ๊ธ - โ
ํยทํด๋ญยทํด๋ง ์ฃผ๊ธฐยทDHCP ๋๊ธฐ์ฐฝ ์ ๋ถ Kconfig(
CONFIG_DAIKIN_ETH_*)๋ก ๋ ธ์ถ - โ
์ ์ก ์ ์ฑ
์ IDF ๋น์์กด
logic/net_link.hpp๋ก ๋ถ๋ฆฌํด ํธ์คํธ ํ ์คํธ โ ๋ผ์ฐํธ ์์ ๊ถ, ๋ถํธ ๋ถ๊ธฐ, ํฌํธ ์ต์ , ํ๋ก๋ธ ํ์ฉ, ์ผ์ด๋ธ ๋ถ๋ฆฌ ๋ณต๊ตฌ - โ
test/test_transport_contract.mjs๊ฐ ์์ค ํ ์คํธ ์์ฒด๋ฅผ ๊ฒ์ฌํด ํธ์ถ๋ถ๊ฐ ๊ทธ ๊ท์น๋ค์ ์ฌ์ ํ ๋ฌป๊ณ ์๋์ง ๋จ์ธ.wifi_start_sta()๋ฅผ ๋ค์ ๋ฌด์กฐ๊ฑด ํธ์ถํ๋ ์ฝ๋๊ฐ ๋ค์ด์ค์ง ๋ชปํ๊ฒ ํ๋ ํญ๋ชฉ ํฌํจ - โ ์ฌ์ฉ์ ๊ฐ์ ๋์ ๋ฌธ์ํ: Connections ํ์ผ์ ํ์ ์๋๋ฅผ ๋ณด์ฌ์ฃผ๋ Ethernet ํ์ด ์๊ธฐ๊ณ , ์ผ์ด๋ธ ์์๊ณผ ์ผ์ด๋ธ ์ฐ๊ฒฐ๋จ, ์ฃผ์ ์์์ ๊ตฌ๋ถํด์ ํ์
- โ
์ ์ก ๊ฒฝ๋ก๋ฅผ ๋๋ฉด(
CONFIG_DAIKIN_ETH_ENABLED=n) ํ๋์ ์ฝ 40 KB๋ฅผ ํ์ํ๊ณ ์ด๋๋ท ์ฝ๋๊ฐ ์์ ๋งํฌ๋์ง ์์
05 โ ํต์ฌ ๊ตฌ์ฑ ์์
๐ WIZnet W5500 โ MACRAW ๋ชจ๋ (Sn_MR = 0x04), ์์ผ 0, 16 KB RX ๋ฒํผ ์ ์ฒด
์ ํ์ ์ ์ ์ ์ก ๊ฒฝ๋ก. SCLK 5 ยท CS 6 ยท MISO 7 ยท MOSI 8์์ SPI mode 0 ยท 20 MHz, INT ์ ์์ด 10 ms ํด๋ง์ผ๋ก ๋๋ 10/100 ์คํ ๋ค๊ณ MAC+PHY. ๋ถํ
์ VERSIONR(0x0039)์ ์ฝ์ด ๊ณ ์ ๊ฐ 0x04์ ๋น๊ตํด ๊ฐ์งํ๋ค. TCP/IP๋ ํธ์คํธ SoC์ lwIP๊ฐ ์ฒ๋ฆฌํ๊ณ , W5500์ ESP32-S3๊ฐ ์ค๋ฆฌ์ฝ์ผ๋ก ๊ฐ์ง ๋ชปํ ๋ ๊ณ์ธต์ ๊ณต๊ธํ๋ค.
๐ฒ ESP32-S3 (M5Stack AtomS3 Lite / Seeed XIAO ESP32-S3)
ํ๋์ 8 MB ์ด์ ํ์ โ 4 MB ์๋์ ์ฝ 2.03 MB OTA ์ฌ๋กฏ ๋ ๊ฐ, ์์ 4 MiB ์ ์ฒด๋ ํ์คํ ๋ฆฌ ์ ๋ ์ ์ฉ. PSRAM์ ์ฐ์ง ์์ผ๋ฉฐ ํ ๊ท์จ ์์ฒด๊ฐ ๋ด๋ถ RAM๋ง ๊ฐ์ ํ๋ค. ๋ธ๋ผ์ฐ์ ์ธ์คํจ๋ฌ๋ฅผ ์ํ ๋ค์ดํฐ๋ธ USB-Serial/JTAG.
๐ M5Stack ATOMIC PoE Base
W5500 ์บ๋ฆฌ์ด. ์ผ์ด๋ธ ํ ๊ฐ๋ฅ์ ์ ์๊ณผ LAN โ ์งํ์ค์์๋ ์ด๊ฒ ์ ๋ถ๋ค. GPIO 5/6/7/8/38, ์ฆ AtomS3 Lite ์ฌ์ด๋ ํค๋ ์ ์ฒด๋ฅผ ์ ์ ํ๋๋ฐ, ํ์จ์ด๋ ์ด๊ฑธ ์ฌ์ฉ์๊ฐ ๋ฐ๊ฒฌํ๊ฒ ๋์ง ์๊ณ ๋ช ์๋ ์ ์ฝ์ผ๋ก ๋ฐ๊พผ๋ค. ์ปจํธ๋กค๋ฌ๊ฐ ๊ฐ์ง๋๋ ์๊ฐ ๊ทธ ๋ค ํจ๋๋ ๋ชจ๋ ํ ์ ํ UI์์ ์ฌ๋ผ์ง๊ณ , ๊ทธ ํ์ ์ง์ ํ ์ค์ POST๋ ๊ฑฐ๋ถ๋๋ค.
๐ฆ espressif/w5500 ^2.0.0 (managed component) ยท ESP-IDF โฅ 6.0
ESP-IDF 6.0์์ SPI ์ด๋๋ท ์นฉ ๋๋ผ์ด๋ฒ๋ค์ด ์ฝ์ด esp_eth ๋ฐ์ผ๋ก ๋น ์ก๊ณ , ์ง๊ธ esp_eth๋ MAC/PHY ํ๋ ์์ํฌ์ ๋ด๋ถ EMAC๋ง ์ฃ๋๋ค. W5500 MAC/PHY ์์ ์ปดํฌ๋ํธ ๋ ์ง์คํธ๋ฆฌ์์ ๊ฐ์ ธ์ค๋ฉฐ, ^2.0.0 ๋ผ์ธ์ด 6.x esp_eth API์ ๋ง์ถฐ ๋น๋๋ ๋ผ์ธ์ด๋ผ ์ด๊ฒ ํ๋ก์ ํธ์ ์ค์ IDF ํํ์ด๋ค.
๐ X10A UART ํญ ยท ๋ค์ดํจ HomeHub (Modbus TCP) ยท M5Stack ENV III
์ธ ๊ฐ์ ๋ฐ์ดํฐ ์์ค, ์ ๋ถ ์ฝ๊ธฐ ์ ์ฉ. ๊ฐ์ ๋ฌผ๋ฆฌ๋์ X10A์ HomeHub๊ฐ ๋ ๋ค ์ค ๋๋ X10A๊ฐ ์ฃผ๋ํ๊ณ , Modbus๋ ๋ผ๋ฒจ์ด ๋ถ์ 2์ฐจ ๊ฐ์ผ๋ก ๊ณ์ ๋ณด์ด๋ฉด์ X10A๊ฐ ์ฃฝ์์ ๋ ํด๋ฐฑ์ ๋งก๋๋ค.
06 โ ์์ฉ ์๋๋ฆฌ์ค
01. PoE ๊ธฐ๋ฐ ๊ธฐ๊ณ์คยท์งํ์ค ํ ๋ ๋ฉํธ๋ฆฌ
์ถ๋ฐ์ ์ด์ ๊ฐ์ฅ ์ด์์ฑ ๋์ ์ผ์ด์ค. ์ ํ๊ฐ ์ ๋ฟ๋ ๊ณณ์ ์ฌ๋ ๋ชจ๋ ๊ฐ์ ๋์ โ ๋ณด์ผ๋ฌ, ํํธํํ, ํํ, ์ปดํ๋ ์, ํฑํฌ ์์, ์๋ธ๋ฏธํฐ. PoE ํ ๊ฐ๋ฅ์ด ์ฝ์ผํธ + AP + ์ค๊ณ๊ธฐ๋ฅผ ๋์ฒดํ๋ค.
02. ๋ชจ๋ ESP32-S3 ์ ํ์ ์ ์ ์ด๋๋ท
S3์ ๋ด์ฅ EMAC์ด ์๊ธฐ ๋๋ฌธ์, ์ด ์ ์ฅ์๋ ์ผ์ด๋ธ์ด ํ์ํ ๋ชจ๋ ESP32-S3 ์ค๊ณ์ ๊ทธ๋๋ก ์ฌ์ฌ์ฉ ๊ฐ๋ฅํ ๋ ํผ๋ฐ์ค๋ค. ํ ๊ณํ, SPI ์ค์ , ํด๋ง ๋ชจ๋ ๊ทผ๊ฑฐ, MAC ํ ๋น, ๋ผ์ฐํธ ์ฐ์ ์์, DHCP ๋ฐ๋๋ผ์ธ, ์์ ํ teardown ๊ฒฝ๋ก๊น์ง ๋ค ์๋ค. net.cpp์ logic/net_link.hpp๋ง ๋ค์ด๋ด๋ฉด ์์
์ ๋๋ถ๋ถ์ด ๋๋๋ค.
03. ์ ์ /๋ฌด์ SKU๋ฅผ ํ๋์ ํ์จ์ด ์ด๋ฏธ์ง๋ก
VERSIONR ํ๋ก๋ธ๋ ๋ํ
์ผ์ด ์๋๋ผ ํจํด์ด๋ค. ์์ดํ์ด SKU์ ์ ์ /PoE SKU๋ฅผ ํจ๊ป ์ถํํ๋ ์ ํ์ด๋ผ๋ฉด ์ด ๋ฐฉ์์ผ๋ก ๋ฐ์ด๋๋ฆฌ ํ๋, OTA ๋งค๋ํ์คํธ ํ๋, ์ธ์คํจ๋ฌ ํ๋๋ฅผ ์ ์งํ๋ฉด์ ํ๋์จ์ด๊ฐ ์ค์ค๋ก๋ฅผ ์๋ฆฌ๊ฒ ํ ์ ์๋ค. ์๊ท๋ชจ ์ ์กฐ์ฌ์๊ฒ ๋ฆด๋ฆฌ์ค ์์ง๋์ด๋ง ํ๋ฉด์ ์ด ์๋ฏธ ์๊ฒ ์ค์ด๋๋ ์ด์ผ๊ธฐ๋ค.
04. ๋ฌด์ ์ด ๋ถ๊ฐ๋ฅํ๊ฑฐ๋ ๊ธ์ง๋ ํ๊ฒฝ์ ์ฝ๊ธฐ ์ ์ฉ ์ฐ์ ๊ฒ์ดํธ์จ์ด
์ํคํ ์ฒ ์ ์ฒด โ ์ด๋์๋ ์ฐ๊ธฐ ๊ฒฝ๋ก๊ฐ ์๊ณ CI๊ฐ ๊ทธ๊ฑธ ๊ฐ์ ํ๋ฉฐ, ์ ๋ขฐ ํ๋ฉด์ด ์ ์ LAN์๋ ์ ์ฒด API๋ฅผ ์ด๊ณ ๊ฐ๋ฐฉํ ์ ์ ๋ผ๋์ค์๋ ๋ซ์ผ๋ฉฐ, syslogยทSNTPยท์๋ช OTA๊ฐ ์ ๋ถ ์ ์ก ๊ณ์ธต์ ๋ฌด๊ดํ ๊ตฌ์กฐ โ ๊ฐ ๋ฌด์ ์ด ๋นํ์ค์ ์ด๊ฑฐ๋ ๊ธ์ง๋ ํ๊ฒฝ์ ๋ชจ๋ํฐ๋ง ๋ธ๋ฆฌ์ง ํ ํ๋ฆฟ์ผ๋ก ์ข๋ค.
๊ฒฐ๋ก
์งํ์ค์ ํํธํํ์๋ ์ผ์ด๋ธ์ด ํ์ํ๊ณ , ๋ฐ์ด๋๋ฆฌ ํ๋๋ง ๋ฐฐํฌํ๋ ํ๋ก์ ํธ๋ ๋ณด๋ ๋ณ์ข ์ ๊ฐ๋นํ ์ ์๋ค.
0x0039์ W5500 ๋ ์ง์คํฐ ํ๋๊ฐ ๋ ๋ค ํด๊ฒฐํ๋ค.
- โ
X10A ์๋น์ค ํฌํธ ์์ ๋์ฝ๋(
I/S๋ณ์ข ), ์ค์ ๋ฒ์ค ์บก์ฒ๋ก ๊ฒ์ฆ - โ Home Assistant ๋์ค์ปค๋ฒ๋ฆฌ MQTT, ๋ด์ฅ ๋ผ์ด๋ธ ์น UI, ์๋ช ๋์ผ ์ฌ๋กฏ OTA, ๋ธ๋ผ์ฐ์ ์ธ์คํจ๋ฌ
- โ CRC์ ๋ง์ง๋ง ํ๋ก๊ทธ๋๋ฐ ์ปค๋ฐ ์๋๋ฅผ ๊ฐ์ถ 4 MiB ์จ์ด ๋ ๋ฒจ๋ง ์ํ ํ์คํ ๋ฆฌ ์ ๋
- โ MACRAW ๋ชจ๋์ ์ ํ์ W5500 ์ ์ ์ ์ก ๊ฒฝ๋ก โ ์ค๋ฆฌ์ฝ์ ์๋ MAC+PHY๋ฅผ ESP32-S3์ ๊ณต๊ธ
- โ
VERSIONR = 0x04๋ฐํ์ ๊ฐ์ง โ ๋ฐ์ด๋๋ฆฌ ํ๋๊ฐ ์ ์ ๋ณด๋์ ๋ฌด์ ๋ณด๋๋ฅผ ํจ๊ป ๋ด๋น - โ M5Stack ATOMIC PoE Base๋ก PoE ๋์: ์ผ์ด๋ธ ํ ๊ฐ๋ฅ์ด ์ ์๊ณผ LAN์ ๊ธฐ๊ณ์ค๊น์ง ์ด๋ฐ
- โ ์ด๋๋ท์ด ๊ธฐ๋ณธ ๋ผ์ฐํธ๋ฅผ ์ฐจ์ง(netif ์ฐ์ ์์ 128)ํ๊ณ ์์ดํ์ด ์คํ ์ด์ ๊ณผ ์บกํฐ๋ธ ํฌํธ์ ๋ชจ๋ ์ต์ , ์ ์ ๋ถํ ์ ํ ์ฝ 50 KB ์ ์ฝ
- โ ์ค์ ๋ X10A ์๋น์ค ๋ฒ์ค์ SPI๋ฅผ ํด๋ญํ์ง ์๋๋ก ๊ฑฐ๋ถํ๋ ํ๋ก๋ธ ๊ฐ๋
- โ ์ ์ ๋ธ๋ง์ ์คํจ๊ฐ ์์ดํ์ด ํด๋ฐฑ์ ์ค์ผ์ํค์ง ์๊ฒ ํ๋ ์์ ํ ์ญ์ ๋๊ฐ๊ธฐ
- โ ์ ์ก ์ ์ฑ ์ ํธ์คํธ ํ ์คํธ ๊ฐ๋ฅํ ์์ ๋ก์ง์ผ๋ก ๋ถ๋ฆฌํ๊ณ ์์ค ํ ์คํธ CI ๊ณ์ฝ ํ ์คํธ๋ก ๊ณ ์
Q&A
Q. W5500์ ์ต๋ ์ฅ์ ์ด ํ๋์์ด์ด๋ TCP/IP ์คํ์ธ๋ฐ, MACRAW๋ก ์ฐ๋ฉด ๊ทธ๊ฑธ ๋ฒ๋ฆฌ๋ ๊ฑฐ ์๋๊ฐ? ESP32-S3๊ฐ ์ด๋ฏธ ์์ ํ ๋คํธ์ํฌ ์คํ์ ์์ ํ๊ณ ์๊ธฐ ๋๋ฌธ์ด๋ค. lwIP, mbedTLS, MQTT ํด๋ผ์ด์ธํธ, mDNS ์๋ต์, 36๊ฐ ๋ผ์ฐํธ HTTP ์๋ฒ๊น์ง. ๋ฐ๋๋ก ๊ฐ์ง ๋ชปํ ๊ฒ ์ด๋๋ท MAC๊ณผ PHY๋ค. S3๋ ์ด๊ธฐ ESP32์ EMAC ํ๋ฆฌํ๋ด์ ํต์งธ๋ก ๋บ๋ค. MACRAW๋ ๋น ์ ธ ์๋ ์๋ ๋ ๊ณ์ธต๋ง ์ ํํ ๊ณต๊ธํ๊ณ ์์ชฝ์ ๊ฑด๋๋ฆฌ์ง ์์ผ๋ฉฐ, ๊ทธ๋์ MQTT ๋ธ๋ฆฌ์ง ์ฝ๋ ํ ์ค ์ ๋ฐ๊พธ๊ณ ์ ์ ์ด ๊ธฐ์กด ํ์จ์ด ๋ฐ์ผ๋ก ๋ฏธ๋๋ฌ์ ธ ๋ค์ด๊ฐ ์ ์์๋ค. ์คํ์ด ์๋ ์ํ MCU์๋ค๋ฉด ๊ฐ์ ์นฉ์ ๋ฐ๋๋ก, TOE ๋ชจ๋๋ก ์ฐ๋ ๊ฒ ๋ง๋ค.
Q. MACRAW ๋ชจ๋๋ TOE ๋๋น ์ค์ ๋ก ์ด๋ค ๋น์ฉ์ ์น๋ฅด๋? ๋ชจ๋ ํ๋ ์์ด SPI๋ฅผ ๊ฑด๋์ค๊ณ ํ๋กํ ์ฝ ์คํ์ ํธ์คํธ CPU๊ฐ ๋๋ฆฌ๋ฏ๋ก, TOE๊ฐ ํก์ํ์ SPI ๋์ญํญ๊ณผ CPU ์ฌ์ดํด์ ์ด๋ค. 9600 ๋ณด๋์จ ์๋ฆฌ์ผ ๋ฒ์ค๋ฅผ ํด๋งํด MQTT ๊ฐ ์์ญ ๊ฐ๋ฅผ ํผ๋ธ๋ฆฌ์ํ๋ ํ ๋ ๋ฉํธ๋ฆฌ ๋ธ๋ฆฌ์ง์์ ๊ทธ ๋น์ฉ์ ๋ณด์ด์ง ์๋ ์์ค์ด๊ณ , ์จ์นฉ 16 KB RX ๋ฒํผ๊ฐ ํด๋ง ์ฌ์ด์ ๋ฒ์คํธ๋ฅผ ํก์ํ๋ค. INT ์ ํ๋ ์์ด 10 ms ํด๋ง์ด ์ฑ๋ฆฝํ๋ ์ด์ ๊ฐ ์ ํํ ๊ทธ๊ฒ์ด๋ค.
Q. ์ W5500์ ์ธํฐ๋ฝํธ ์ถ๋ ฅ์ ์ ์ฐ๊ณ ํด๋งํ๋? M5Stack ATOMIC PoE Base๊ฐ SCLKยทCSยทMISOยทMOSI์ ์ ์๋ง ๋ผ์ฐํ ํด์ ๋ฐฐ์ ํ INT ํ ์์ฒด๊ฐ ์๋ค. ํด๋ง ๋์์ ์ฐํ์ฑ ์ด ์๋๋ผ ESP-IDF๊ฐ ์ ์ ์ง์ํ๋ ๊ตฌ์ฑ์ด๊ณ , ํด๋ง ์ฃผ๊ธฐ๋ ์ฒ๋ฆฌ๋์ด ์๋๋ผ ์ง์ฐ์ ์ ํํ๋ค. ํด๋ง ํ ๋ฒ๋ง๋ค W5500์ด ์ด๋ฏธ ๋ฒํผ๋งํด๋ ๊ฒ์ ์ ๋ถ ๋น์ฐ๊ธฐ ๋๋ฌธ์ด๋ค.
Q. ๊ฐ์ ๋ฐ์ด๋๋ฆฌ๊ฐ ์ด๋ป๊ฒ ์ด๋๋ท ์๋ ๋ณด๋์ ์๋ ๋ณด๋๋ฅผ ๋์์ ๋ด๋นํ๋? 0x0039์ VERSIONR์ ๋ชจ๋ W5500์์ ๊ณ ์ 0x04๋ฅผ ์ฝ๊ณ , ํ๋กํ
MISO๋ 0x00 ๋๋ 0xFF๋ฅผ ์ฝ๋๋ค. ๋ฐ๋ผ์ ๋ถํ
์ 4๋ฐ์ดํธ SPI ์ ์ก ํ ๋ฒ์ด "์ฌ๊ธฐ ์ปจํธ๋กค๋ฌ๊ฐ ๋ฌผ๋ ค ์๋ค"์ "์ด ํจ๋๋ ๋น์ด ์๋ค"๋ฅผ ํ์ค์ ์คํ ์์ด ๊ตฌ๋ถํ๋ค. ์ฐพ์ผ๋ฉด ์ ์ ์ ์ฌ๋ฆฌ๊ณ ๋ผ๋์ค๋ฅผ ๊ฑด๋๋ด๋ค. ๋ชป ์ฐพ์ผ๋ฉด SPI ๋ฒ์ค๋ฅผ ํด์ ํ๊ณ ์์ดํ์ด ์ ์ฉ ๋น๋์ ๋๊ฐ์ด ๋์ํ๋ค.
Q. W5500์ด ์ฐ๋ ํ์ ์ด๋์ด๊ณ ๊ทธ ๋๊ฐ๋ ๋ฌด์์ธ๊ฐ? SCLK 5 ยท CS 6 ยท MISO 7 ยท MOSI 8์ด๋ฉฐ ์ ๋ถ Kconfig๋ก ๋ณ๊ฒฝ ๊ฐ๋ฅํ๋ค. AtomS3 Lite์์๋ PoE ๋ฒ ์ด์ค๊ฐ ์ฌ์ด๋ ํค๋ ์ ์ฒด๋ฅผ ๋ฎ์ผ๋ฏ๋ก X10A๊ฐ Grove ํฌํธ๋ฅผ ์จ์ผ ํ๊ณ , ๊ฒฐ๊ณผ์ ์ผ๋ก ์ด๋๋ท ์ค์น์๋ ์ ํ์ ENV III ์ผ์์ ์ค ํ์ด ๋จ์ง ์๋๋ค. ํ์จ์ด๋ ์ด ์ถฉ๋์ ์ฌ์ฉ์๊ฐ ๊ฒช๊ฒ ๋์ง ์๊ณ ๋ฏธ๋ฆฌ ๋ช
์ํ๋ค. Seeed XIAO ESP32-S3์์๋ ๊ฐ์ ๋ค ํจ๋๊ฐ ์ฌ์ ์๊ฒ ๋์ ์์ด ์๋ฐฐ์ W5500 ๋ชจ๋๋ก๋ X10A์ ENV III ์์ชฝ ํ์ด ๋จ๋๋ค.
Q. WIZnet ๋ถํ์ผ๋ก ์ด ์ค๊ณ๋ฅผ '๊ฐ๋ฅํ๊ฒ' ํ๋ ๊ฑธ ๋์ด '๋ ์ข๊ฒ' ๋ง๋ค ์ ์๋? ๋ ๋ฐฉํฅ์ด ์๋ค. ๊ฐ์ SPI ์๋ฆฌ์ W6100์ ๋ฃ์ผ๋ฉด IPv6๊ฐ ํ์ํ ๋คํธ์ํฌ๋ฅผ ์ํด ๋์ผ์คํ์ด ์ถ๊ฐ๋๋ค. ์๋ก ์ค๊ณํ๋ค๋ฉด W55RP20์ด ์ปจํธ๋กค๋ฌ์ RP2040์ ํ ํจํค์ง๋ก ํฉ์ณ์ค๋ค. ESP32-S3์ ์์ดํ์ด๊ฐ ๋ ์ด์ ํต์ฌ์ด ์๋ ์ ์ฉ PoE ํ ๋ ๋ฉํธ๋ฆฌ ๋ ธ๋๋ผ๋ฉด ํนํ ๋งค๋ ฅ์ ์ธ ์ ํ์ง๋ค.
์ ์ฌ ์ฝํ ์ธ โ ESP32-S3 + WIZnet: Update Your App Over Wi-Fi or Ethernet
๋ ํ๋ก์ ํธ ๋ชจ๋ ESP32-S3์ WIZnet ์ปจํธ๋กค๋ฌ๋ฅผ ์น๊ณ OTA๋ฅผ ์ง์งํ๊ฒ ๋ค๋ฃจ์ง๋ง, ์ ๋ฐ์ดํธ ๋ก์ง์ ์ฑ ๊ฒฝ๊ณ์ ์ ๋ฐ๋ํธ์ ๋๋๋ค. ์ฌ๊ธฐ์ ๋น๊ตํ ๊ฐ์น๊ฐ ์๋ ๊ฑด ๊ทธ ์ถ ํ๋๋ค.
| OTA ๊ด์ | ์ด ํ๋ก์ ํธ | WIZnet OTA ๋ถํธ๋ก๋ |
|---|---|---|
| ์ ๋ฐ์ดํธ ๋ก์ง์ ์์น | ์ฑ ์ด๋ฏธ์ง ๋ด๋ถ | ๋ฎ์ด์ง ์๋ factory ํํฐ์
|
| ์ฑ ์์ฒด์ OTA ์ฝ๋ | ๋ชจ๋ ๋น๋์ ์๊ตฌ ํ์ | ์์ โ ์์ ์ฑ์ ๋คํธ์ํน 0์ค, 80์ค |
| OTA๋ฅผ ๋น ๋จ๋ฆฐ ์ด๋ฏธ์ง | USB ์์ด๋ ๋ณต๊ตฌ ๋ถ๊ฐ | ์ ์ ์ค์นยท๋์ |
| ์ง์ ์กฐ๊ฑด | ์ฑ์ด ์๋ช ๋ HTTPS ๋งค๋ํ์คํธ๋ฅผ ํด๋ง | BOOT ๋ฒํผ, ๋น otadata, ๋๋ ์ฑ์ ์์ฒญ |
| ๋ค์ดํ์ | ์์ โ ๋ค์ด๋ก๋ ์ค์๋ ์ฑ์ด ๊ณ์ ๋์ | ๋ฆฌ๋ถํธ โ ๋ก๋ โ ๋ค์ด๋ก๋ โ ๋ฆฌ๋ถํธ |
| ์ด๋ฏธ์ง ์ง์ | ๋ถํธ ์ฌ๋กฏ ์ง์ ์ RSA-3072 ์๋ช ๊ฒ์ฆ + 2์ ๋ค์ด๊ทธ๋ ์ด๋ ๊ฒ์ดํธ | ์ ์ก ๊ตฌ๊ฐ HTTPS, ์ธ์ฆ์๋ factory์ ๊ณ ์ |
| ์คํจ ๋ณต๊ตฌ | ๋ฌด์ฅ๋ ๋กค๋ฐฑ + ์ฐ๊ฒฐ์ฑ ์ฆ๋ช ํฌ์ค๊ฒ์ดํธ | BOOT ๋ฒํผ์ผ๋ก ๋คํธ์ํฌ์์ ์ ์ด๋ฏธ์ง ์์ |
| ์ธํฐํ์ด์ค | ๋ถํ ๋น ํ๋ โ ์ ์ ์ด ์ด๊ธฐ๋ฉด ๋ผ๋์ค๋ ์์ ๋ฏธ๊ธฐ๋ | ์ด๋๋ท๊ณผ ์์ดํ์ด ๋์ ๊ธฐ๋, ์ญํ ๋ถ๋ฆฌ |
ํธ๋ ์ด๋๋ ์๋ฐฉํฅ์ผ๋ก ๊น๋ํ๊ฒ ์ฝํ๋ค. OTA๋ฅผ ์ฑ ์์ ๋์๊ธฐ ๋๋ฌธ์ ์ด ํ์จ์ด๋ ์๊ธฐ ์
๋ฐ์ดํธ์ ํ์กฐํ ์ ์๋ค โ ํ์ ๋ฆฌ์คํ๊ณ , MQTT ํผ๋ธ๋ฆฌ์
์ X10A ํด๋ฌ๋ฅผ ๋น์ผ์ธ์ฐ๊ณ , ์งํ ์ค์ธ ๋ ์จ ์์ฒญ์ ์ ํ ์๊ฐ ์์ ์ ์ฌ์ด๋ค. OTA๋ฅผ factory ํํฐ์
์ผ๋ก ์ฎ๊ธฐ๋ฉด ๊ทธ ํ์กฐ๊ฐ ๋ถ๊ฐ๋ฅํด์ง๋ ๋์์ ๋ถํ์ํด์ง๋ค. ์ฑ์ด ์ด๋ฏธ ์ ์งํด ์๊ธฐ ๋๋ฌธ์ด๋ค. ๊ทธ๋ฆฌ๊ณ ๊ทธ ์ด๋์ ์ด ํ๋ก์ ํธ๊ฐ ๋ฐฉ์ดํ ์ ์๋ ๋จ ํ๋์ ์คํจ๋ฅผ ์ ๊ฑฐํ๋ค โ ๋ถํ
๋๊ณ , ์ฐ๊ฒฐ์ฑ์ ์ฆ๋ช
ํ๊ณ , ์ค์ค๋ก๋ฅผ ๋ด์ธํ ๋ค, ๋ค์๋ ์
๋ฐ์ดํธ๋์ง ๋ชปํ๋ ๊ฑด๊ฐํ ์ด๋ฏธ์ง.