Understanding and Using Ethernet-enabled MCUs for Your Next Application



MCUs offer a very wide range of Ethernet connectivity choices. With most applications demanding Internet connectivity, it’s more likely than not that your next MCU-based design will need some type of network connection. Whether your next design is a sensor that needs to consolidate and communicate data over an Ethernet link, a network-connected security camera that needs to have periodic code updates sent via the network connection, or an industrial controller that needs to use a robust industrial Ethernet connection, your choice of Ethernet-enabled MCU will be critical in delivering the capabilities required for a successful design.

Ubiquitous connectivity

Ethernet is perhaps the most successful and ubiquitous data communications standard since the telegraph. It has survived years of enhancements and modifications that have carried it from the original 10 Mbit/sec specification all the way up to 100 Gbit/sec and beyond. Versions with additional reliability, like Industrial Ethernet, are now available as well as versions with better synchronous capabilities for the transmission of real-time data such as audio and video. Ethernet with added security is growing rapidly as embedded systems become targets for hackers and viruses. Let’s look at some examples of Ethernet-enabled MCUs and the target applications they serve to better understand the choices you face when selecting the right MCU for your embedded application.

Inexpensive Ethernet implementations

You might think that adding Ethernet to an embedded system is still a pricy option, but even low-cost MCUs have Ethernet connectivity available. In fact, by using the venerable Microchip PIC32MX795 MCU, paired with the Texas Instruments DP83848 Ethernet PHY, your key component cost is very low (use the links for current Hotenda unit prices). The PIC32MX795 also has a variety of features that make it easy to implement many common Ethernet-related functions. Of special interest are the DMA controller, Interrupt system, and Low-Power Modes. By combining these features it’s possible to wake the system from a low-power state when a packet is received (perhaps using a “Magic Packet”). The DMA controller can then be used to transfer data while the CPU is processing data, minimizing the required “on-time” of the CPU. This makes implementing network- enabled sensors, and similar embedded systems, surprisingly power efficient.

Perhaps the most useful element of the Microchip PIC32 Family Ethernet solution is the free licensed stack available for embedded designs. The stack, illustrated on the right side of Figure 1 next to the Microchip Ethernet Starter Kit Board, is divided into multiple layers, where each layer accesses services from one or more layers directly below it.


Figure 1: PIC32 Ethernet Starter Kit Board and Free Licensed TCP/IPStack. (Courtesy of Microchip)

Many of the TCP/IP layers are “live”, in the sense that they not only act when a service is requested, but also when events like time-out or new packet arrival occurs. This makes it easier to support simple embedded applications that may not require an OS or RTOS. Some of the key features of the Microchip TCP/IP stack include:
  • Supported Protocols: ARP, IP, ICMP, UDP, TCP, DHCP, SNMP, HTTP, FTP, TFTP
  • Socket support for TCP and UDP
  • Secure Sockets Layer (SSL)
  • NetBIOS Name Service
  • DNS – Domain Name System
  • Ethernet Device Discovery
Microchip offers several tutorials (including a Product Training Module on its PIC32 family), design examples and even full reference designs to make it easy to create TCP/IP-enabled embedded systems. As an example, a tutorial is available from Microchip showing the design of a network-enabled vending machine.¹

Industrial Ethernet implementations

If you need a more rugged and robust Ethernet implementation you might consider using an MCU that supports Industrial Ethernet. Some MCUs provide dedicated hardware not only for the Ethernet interface but also for management and control so the CPU is available for other tasks. The Texas Instruments Sitara Family of devices, such as the AM3352BZCZ60, has a complete Programmable Real-Time Unit Subsystem and Industrial Communication Subsystem (PRU-ICSS). This dedicated hardware element consists of dual 32-bit RISC cores (Programmable Real-Time Units, or PRUs), shared, data, and instruction memories, internal peripheral modules, and an interrupt controller (INTC). The programmable nature of the PRU (Figure 2), along with its access to pins, events, and all on-chip resources, provides flexibility in implementing fast real-time responses, specialized data handling operations, custom peripheral interfaces, and in offloading tasks from other on-chip processing elements.


Figure 2: Texas Instruments’ Sitara MCU features a Programmable Real-Time Unit Subsystem and Industrial Communication Subsystem (PRU-ICSS). [Courtesy of Texas Instruments]

The PRUs have access to all on-chip resources through the Interface/OCP Master port, and the external host processors can access the PRU-ICSS resources through the Interface/OCP Slave port. The 32-bit interconnect bus connects the various internal and external masters to the resources inside the PRU-ICSS. The INTC handles system input events and posts events back to the device-level host CPU.

The PRU cores are programmed with a small, deterministic instruction set. Each PRU can operate independently or in coordination with each other and can also work in coordination with the device-level host CPU. This interaction between processors is determined by the nature of the firmware loaded into the PRU’s instruction memories. The Industrial Ethernet Peripheral (IPE) is used to manage and generate Industrial Ethernet functions including:
  • One Industrial Ethernet timer with 10 capture and eight compare events
  • Two Industrial Ethernet sync signals
  • Two Industrial Ethernet 16-bit watchdog timers
  • Industrial Ethernet digital IOs
The existence of the dedicated PRU cores and the IPE dramatically simplify the design of an Industrial Ethernet-enabled embedded application. Texas Instruments also supplies several software packages that support popular Operating Systems (OSs) such as Linux and Android for embedded applications that require more functionality than a simple sensor or meter. OS functionality can be a key requirement for more complex industrial applications where secure communications, file systems, image processing, and robust user interfaces are needed.

Energy-efficient Ethernet designs

Some MCUs provide a combination of low-power and performance efficiency in order to deliver the most data and processing bandwidth for the least amount of power consumption. The Freescale Kinetis MK60DN512 includes dedicated hardware to support a wake from low-power mode function specifically tailored for Ethernet. The Ethernet port can provide an asynchronous wake-up source for the low-power state when a Magic Packet is received. As shown in Figure 3, this source is just one of several that allow the design to be energy efficient when using a variety of communications peripherals, GPIO pins, and internal timers.


Figure 3: Asynchronous Low-Power Mode wake-up sources for the Kinetis MK60 MCU family. (Courtesy of Freescale)

The on-chip Ethernet MAC block includes several key features that dramatically improve transfer efficiency. A special embedded FIFO on the receiver path provides for loss-less flow control (for example, automated 802.3 x31A pause-frame generation and termination) to improve data transfer efficiency. The on-chip IEEE 1588 timer can also be used for time-sensitive Ethernet implementations, such as Industrial Ethernet. Hardware acceleration is included to optimize the performance of network controllers providing IP and TCP, UDP, ICMP protocol services. The acceleration block performs critical functions in hardware, which are typically implemented with a significant CPU processing overhead. A few of the IP Protocol performance optimization features include:
  • Operates on TCP/IP and UDP/IP and ICMP/IP protocol data or IP header only
  • Enables wire-speed processing
  • IPv4 and IPv6 support
  • Transparent passing of frames of other types and protocols
  • Support for VLAN tagged frames according to IEEE 802.1q with transparent forwarding of VLAN tag and control field
  • Automatic IP-header and payload (protocol specific) checksum calculation and verification on receive
  • Automatic IP-header and payload (protocol specific) checksum generation and automatic insertion on transmit configurable on a per-frame basis
  • Support for all IEEE 1588 frames
The hardware high-level protocol acceleration functions not only improve Ethernet data transfer efficiency, they also provide a significant improvement in CPU processing efficiency. Since the CPU does not need to implement many of the common housekeeping functions associated with implementing higher-level protocols, it can be either put in a lower-power state or be doing other processing tasks.

Ethernet-connected system security

Embedded Ethernet applications are becoming increasingly concerned about security of both data transfers and data at rest within the embedded system. U.S. Department of Homeland Security reports of potential attacks against connected embedded systems within the energy grid, like that from “Energetic Bear”,² show just how vulnerable embedded systems have become. Attackers can even “take over” an embedded system by installing code at the lowest level of the operating system, the code that “boots” the system. Once the boot code is compromised, hackers can make any modifications they want to extract secret information, or even take over control of the system to damage expensive equipment or, in the worst case, to damage an entire processing complex.

Some MCUs and MPUs now include special hardware to support secure data transmission and even secure boot. The Atmel SAMA5D33, with its secure-boot mechanism, hardware accelerated engines for encryption (AES, TDES), and hash function (SHA), ensures anti-cloning (so that the MCU cannot be copied or reverse engineered by simply reading out all on-chip data), code protection, and secure external-data transfers. The SAMA5D3 also has two separate Ethernet ports (one featuring 10/100/1000 Mbps connections and one for 10/100 Mbps connections) for implementing embedded systems that need to support bridging, routing, and aggregation. Bridges and routers are typically key targets for network intrusion attacks since they provide access to much more of the network, as opposed to sensors or meters which are typically at the end nodes of the system and have limited access to the rest of the system. Thus, secure boot is a critical capability for bridges and routers; so having this feature on the SAMA5D3 family is a big advantage.

In summary

In many applications Ethernet connectivity is now a requirement and MCU vendors are responding with a variety of Ethernet-enabled MCUs. You should select your target MCU based on the type of Ethernet connectivity your application needs — Industrial Ethernet, Ethernet with additional security, low power, or a low-cost solution. Look carefully and you will probably find an MCU optimized for your application.

For more information on the parts discussed in this article, use the links provided to access product information pages on the Hotenda website.

References
  1. Microchip Ethernet Example Design (Part 1 of 3).
  2. Reuters article: “U.S. government asks firms to check networks after 'Energetic Bear' attacks”.
Supplier