meta data for this page
Differences
This shows you the differences between two versions of the page.
| com:eth_and_micro [2026/07/27 21:46] – created vamsan | com:eth_and_micro [2026/07/27 23:01] (current) – vamsan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Ethernet and microcontrollers ====== | ====== Ethernet and microcontrollers ====== | ||
| + | A physical Ethernet connection serves as a dedicated hardware link that directly connects local microcontrollers to LANs and industrial fieldbuses. Unlike wireless solutions, a wired Ethernet port ensures reliable, low-latency, | ||
| + | **The MAC (Media Access Control) – The Data Brain** | ||
| + | |||
| + | The MAC operates at **Layer 2 (Data Link)** of the OSI model. It acts as the logic controller that packages data into standardized network frames. | ||
| + | |||
| + | * **Core Duties:** Appends or reads destination and source MAC addresses, calculates error-checking checksums (CRC), and enforces network access rules to prevent packet collisions. | ||
| + | * **Implementation: | ||
| + | |||
| + | **The PHY (Physical Layer Transceiver) – The Electrical Muscle** | ||
| + | |||
| + | The PHY operates at **Layer 1 (Physical)** of the OSI model. It acts as the hardware translator that turns digital logic into raw physics. | ||
| + | |||
| + | * **Core Duties:** Translates the digital 1s and 0s from the MAC into differential voltage signals (or pulses) that travel down the physical copper twisted-pair Ethernet cable. It also handles auto-negotiation for line speed (10 vs. 100 Mbps). | ||
| + | * **Implementation: | ||
| + | |||
| + | **How They Talk: MII and RMII** | ||
| + | |||
| + | The MAC and the PHY must communicate through a highly synchronised digital bus on your PCB. The most common standard is RMII (Reduced Media Independent Interface), which requires a shared, ultra-stable 50 MHz clock signal to precisely sync the transmission and reception lines between the two layers. | ||
| + | |||
| + | ==== Comparison of some popular Ethernet solutions ==== | ||
| + | ^ Criteria ^ W5100 ^ W5500 ^ W6100 ^ CH9120 ^ ENC28J60 ^ LAN8720 ^ | ||
| + | ^ Price-Level | **Medium** (Becoming obsolete, making modules slightly pricier than W5500) | **Medium-Low** (Mass-produced, | ||
| + | ^ Advantage | * Hardware TCP/IP offloads MCU\\ * Massive community libraries\\ * Industry-proven stability | * Fast SPI clock (80MHz)\\ * Low power consumption\\ * 8 independent sockets | * Native IPv4 and IPv6 support\\ * Pin-compatible upgrade for W5500\\ * 8 sockets | * Extremely easy to use\\ * Requires no TCP/IP stack library\\ * Pure serial-to-ethernet bridge | * Very low cost\\ * Small footprint\\ * Widely available in cheap modules | * True high-speed throughput\\ * Low latency\\ * Uses MCU's native MAC hardware | | ||
| + | ^ Disadvantage | * Old technology\\ * High power consumption / runs warm\\ * Low socket count (4) | * Limited to IPv4 only\\ * Requires external library (Wiznet) | * Slightly higher cost\\ * Libraries are newer and less mature than W5500 | * Not flexible for complex protocols\\ * Limited to only 2 concurrent sockets | * No hardware TCP/IP stack\\ * Consumes massive MCU RAM and Flash\\ * Slow SPI limits speed | * No MAC layer inside\\ * Requires complex RMII wiring (10+ pins)\\ * Only works with advanced MCUs | | ||
| + | ^ Supported MCUs | * All 8-bit to 32-bit MCUs\\ * Arduino Uno/Mega\\ * STM32, ESP32, RP2040 | * All 8-bit to 32-bit MCUs\\ * Arduino, ESP32, ESP8266\\ * STM32, RP2040/ | ||
| + | ^ Technical Parameters | * Speed: 10/100 Mbps\\ * Sockets: 4\\ * Buffer: 16 KB Tx/Rx\\ * Voltage: 3.3V (5V tolerant IO) | * Speed: 10/100 Mbps\\ * Sockets: 8\\ * Buffer: 32 KB Tx/Rx\\ * Voltage: 3.3V (5V tolerant IO) | * Speed: 10/100 Mbps\\ * Sockets: 8\\ * Buffer: 32 KB Tx/Rx\\ * Voltage: 3.3V | * Speed: 10/100 Mbps\\ * Sockets: 2\\ * Buffer: Internal (Fixed configuration)\\ * Voltage: 3.3V - 5V | * Speed: 10 Mbps only (No Fast Eth)\\ * Sockets: Managed by software\\ * Buffer: 8 KB Tx/Rx\\ * Voltage: 3.3V | * Speed: 10/100 Mbps\\ * Sockets: Managed by software/ | ||
| + | ^ Communication Bus | * SPI\\ * Parallel Bus | * High-Speed SPI (Up to 80 MHz) | * High-Speed SPI | * UART (Serial) via AT Commands / Config Tool | * SPI (Up to 20 MHz) | * RMII (Reduced Media Independent Interface) | | ||
| + | ^ Simatic Modbus TCP | * **Yes** (Via Arduino/MCU Modbus client/ | ||
| + | |||
| + | ==== What is the difference between on-board and external solutions? ==== | ||
| + | ^ Criteria ^ On-board Ethernet (Native MAC + External PHY) ^ External Ethernet Solutions (SPI/UART Controllers) ^ | ||
| + | ^ Description | The microcontroller has a built-in Ethernet MAC core. It connects directly to a physical layer transceiver chip (PHY like LAN8720) via RMII/MII interfaces. | The Ethernet MAC, PHY, and often the TCP/IP stack are integrated into a single external chip (like W5500). It connects to any standard MCU via SPI or UART. | | ||
| + | ^ Advantage | * **Maximum Speed:** Offers full 10/100 Mbps or Gigabit line rates without bus bottlenecks.\\ * **Low Latency:** Direct memory access (DMA) bypasses serial buses.\\ * **Highly Flexible:** Complete software control over raw packets, custom protocols, and advanced routing. | * **Saves MCU Resources: | ||
| + | ^ Disadvantage | * **High MCU Resource Consumption: | ||
| + | ^ Typical Components | * ESP32, STM32F4/ | ||
| + | ^ Ideal Use Cases | * Industrial gateways with heavy traffic.\\ * Video streaming or high-frequency data logging.\\ * Systems running a Real-Time OS (RTOS) or Linux with advanced security (TLS/SSL). | * Simple IoT sensors, MQTT clients, and Modbus TCP nodes.\\ * Projects using small, low-cost microcontrollers with limited RAM.\\ * Rapid prototyping and simple PCB layouts. | | ||
| + | |||
| + | ==== Comparison of some microcontrollers with on-board Ethernet ==== | ||
| + | ^ Product Setup ^ Solution Type ^ Controller / PHY Used ^ Price-Level (Approx.) ^ Main Use Cases ^ Effectivity & Network Performance ^ | ||
| + | | **Waveshare RP2040-ETH**\\ (Raspberry Nano Ethernet style) | **External**\\ (Integrated Chip) | WCH CH9120\\ (UART-to-Ethernet Bridge) | **Low**\\ (~€11 - €15) | * Simple headless serial data streaming\\ * Remote Modbus-RTU to Modbus-TCP bridges\\ * Compact IoT telemetry devices | **Medium-Low: | ||
| + | | **Arduino Uno R3 / R4**\\ + Arduino Ethernet Shield 2 | **External**\\ (Stackable Shield) | WIZnet W5500 | **Medium**\\ (~€35 - €45 total) | * Learning & academic prototypes\\ * Home automation switches\\ * Small local web servers for status toggles | **Medium:** Excellent hardware offloading (TCP/IP is handled by the shield). However, an 8-bit Uno R3 can struggle with large data buffers despite the chip's speed. | | ||
| + | | **Arduino Nano**\\ + Nano Ethernet Shield v1.0 | **External**\\ (Mini Shield Base) | Microchip ENC28J60 | **Very Low**\\ (~€8 - €12 total) | * Lowest-cost custom sensors\\ * Simple ping utilities\\ * Tiny local network triggers | **Low:** The shield lacks a hardware TCP/IP stack, meaning the software network stack must run directly on the Nano's tiny 2KB RAM. Highly prone to crashes under moderate network loads. | | ||
| + | | **Arduino MKR Series**\\ + Arduino MKR ETH Shield | **External**\\ (Industrial Form Factor) | WIZnet W5500 | **High**\\ (~€55 - €70 total) | * Industrial IoT edge gateways\\ * Smart building sensors\\ * Professional-grade PLC Modbus TCP nodes | **High:** Blends a high-performance, | ||
| + | | **ESP32 DevKitC**\\ + LAN8720 Module | **On-board**\\ (Native MAC + Ext. PHY) | Native ESP32 EMAC\\ + LAN8720 PHY | **Low**\\ (~€8 - €12 total) | * High-speed Wi-Fi to Ethernet bridging\\ * Real-time data logging / WebSocket servers\\ * TLS/SSL secured internet appliances | **Very High:** Native DMA access completely eliminates serial bus bottlenecks, | ||
| + | | **STM32F407VET6 Black Board**\\ (with native RJ45 port onboard) | **On-board**\\ (Native MAC + Integrated PHY) | Native STM32 MAC\\ + LAN8720 (or DP83848) | **Medium-Low**\\ (~€15 - €25) | * Industrial control machinery\\ * Heavy-traffic Modbus gateways to SCADA systems\\ * Multithreaded RTOS network routing | **Maximum: | ||
| + | |||
| + | ===== Ethernet topics on lamaPLC ===== | ||
| + | {{topic> | ||
| + | |||
| + | \\ | ||
| + | \\ | ||
| + | {{tag> | ||
| + | \\ | ||
| + | This page has been accessed for: Today: {{counter|today}}, | ||