Give away medical masks when you place an order. learn more

Ethernet on a Budget for MCU-Based Embedded Designs


Connectivity for embedded devices is a must-have as we move into a pervasive Internet of Things (IoT) world. Wireless connectivity seems to be the predominant trend, but most wireless devices eventually need to find a wired Internet connection for increased bandwidth and reliability. Our good friend the traditional wired Ethernet connection is still needed in hub, aggregator, bridge, storage, and application server embedded nodes. Low-cost sensors may also use wired Ethernet instead of a wireless solution when cost, bandwidth, convenience, or reliability concerns rule out a wireless approach. Fortunately, many low-cost MCU families now provide wired Ethernet support so sensors, inexpensive bridges, and connectivity aggregators can be developed without “breaking” the budget bank. 

This article will provide an overview of the types of inexpensive MCUs that support wired Ethernet connectivity. Examples of some common embedded applications where wired connectivity will be desired will be given to demonstrate how key MCU features and capabilities match with important application requirements.

Ethernet connectivity in the embedded world

Ethernet is such a pervasive element in embedded systems we usually do not give it much thought -- it’s just the “ether” over which computers communicate.  Since its initial standardization in 1985 Ethernet has grown and evolved from the original 3 Mbit/s data transfer rate to 100 Gbit/s and has spawned a variety of different media and connection topologies. The flexibility of the multi-layer OSI model and the underlying message structure supported the evolution and optimization that has allowed Ethernet to survive and prosper over several decades.

Embedded devices use Ethernet connectivity to send and receive data and control information. More advanced embedded systems can use Ethernet to transmit and receive code updates to add new features and to fix bugs or security weaknesses that can be exploited by hackers to steal confidential information. These updates must be protected from security exploits, or hackers can use the update facility to fully compromise the system and use it as an entry point to attack other portions of the network.  Even low-cost embedded systems may make use of the convenience of remote updates, so some level of security must be considered even when the design is done “on a budget.”

One of the reasons Ethernet has survived so long is that early versions of the standard have become more and more cost-effective. For example, the low bandwidth 10 Mbit/s and 100 Mbit/s versions of the standard (10BASE-T and 100BASE-TX), running on twisted pair cables and 8P8C modular connectors, is still a popular version even decades after standardization. These versions are now commonly supported in low-cost MCUs and can provide connectivity even for significantly cost-constrained designs.

For more information on the Ethernet standard Hotenda offers resources such as the Microchip Product Training Module on Embedded Ethernet that discuss the Ethernet standard and various devices that support Ethernet implementations.

Ethernet connectivity on a budget

MCU vendors are providing Ethernet connectivity even in some of their lowest-end devices. This makes it possible to add Internet connectivity to even low-cost sensors, controllers, and other elements at the periphery of a distributed system. One of the most pervasive MCU families is the PIC from Microchip, and the PIC18F MCU family has some members with an on-chip 10BASE-T Ethernet controller and integrated PHY. This makes it possible to connect to Ethernet using only an external connecter with integrated magnetics, like the Bel Fuse S811-1X1T-06-F. The integrated PHY is very simple, since it implements the lower-speed 10BASE-T standard, but it can still connect to 100BASE-T and 1000BASE-T standards due to their backward compatibility.

Even though the Microchip PIC18F97J60 MCU is inexpensive, the Ethernet controller has several advanced capabilities that make it easy on the software required to implement the higher levels of the communications protocol. As seen in Figure 1 an 8-Kbyte Ethernet RAM buffer is included in the controller for local packet storage reducing bandwidth requirements on system memory. An arbiter manages access to the data buffer from the DMA controller, the CPU, the transmit block, and the receive block to maximize performance and efficiency.

Figure 1: Microchip PIC18F97J60 Ethernet Controller Block Diagram. (Courtesy of Microchip)

One of the other advanced features of the PIC18F Ethernet controller is the ability to wake upon the reception of a special packet. This is particularly useful in sensor applications where the device can be put into a low-power mode until a reading is needed. When the wake packet is received the CPU is interrupted and transitions out of the low-power state. Sensor readings are made and communicated back to the host via Ethernet. The CPU goes back into the low-power mode until another wake packet is received.

Building bridges

Often, multiple sensors with different interface requirements need to be consolidated and “bridged” onto a single standard interface. In this application the MCU may need to have a more robust Ethernet implementation, perhaps using the 100BASE-T standard to boost performance over the single-sensor device we saw previously where the slower 10BASE-T standard was sufficient.  The MCU also needs to support a wide variety of other standards, such as USB, SPI, I2C, CAN, and SMBus/PMBus so it can cover the full range of potential sensor interfaces. For example, the STMicroelectronics STM32F405xx/7xx MCU not only supports Ethernet 10/100BASE-T connectivity, but a host of other popular interfaces as well. As shown in the block diagram in Figure 2, it supports all the common interfaces, and since it is available in a variety of packages from 64 pins to 176 pins you can match the device to the precise number of interface ports you need to optimize board space use.

Figure 2: Block Diagram of ST Microelectronics STM32F405xx/7xx MCU. (Courtesy of ST Microelectronics)

Another key feature of the STM32F405xx/7xx that makes it a good match for bridging applications is the structure of its on-chip buses. Notice that the low-speed serial peripherals are organized on two different buses with separate DMA controllers to minimize bus conflicts. The Ethernet and USB interfaces have their own connections into the high-speed AHB bus-switch matrix for prioritized access to both on-chip and external memory. This type of flexible on-chip bus structure can be critical when combining and consolidating multiple sensor data streams for communication over a single Ethernet interface.

Aggregation and storage

In some low-cost embedded applications there will be enough data generated by local sensors or aggregated from remote sensor hubs that the internal storage available in the MCU won’t be sufficient. In these cases, external-memory controllers will be needed to manage external-storage devices. For medium-capacity applications static memory will be sufficient, but in high-capacity applications dynamic memory will be required. A memory controller, like that on the NXP LPC178x/7x supports either type of interface and can be particularly efficient since multiple product variants, with different memory requirements, can be supported with the same MCU. As shown in Figure 3, both static memory (ROM, RAM and Flash) and dynamic memory (SDRAM) are supported making it possible to store significant amounts of data. Embedded data buffers are useful in merging write transactions to minimize memory accesses. Read operations can use the buffer to aggregate transactions to minimize bus bandwidth. Additionally, accesses to previously buffered locations can use the buffered data instead of the external memory, improving memory bandwidth and reducing power consumption.

Figure 3: NXP LPC178x/7x External Memory Controller Block Diagram. (Courtesy of NXP)

Security precautions

In some Ethernet-connected embedded systems security will be a key consideration. Many low-cost MCUs don’t have integrated security functions, but there are security peripherals available to add security capabilities to a low-cost MCU system. The Atmel CryptoAuthentication ATSHA204A  Security Device, for example, can store security keys, authenticate received data, and generate random numbers for use in common security protocols. The standard Secure Hash Algorithm (SHA) is used to generate and check security digests used to securely authenticate transmissions. A list of the types of security commands available in the device is shown in Figure 4. The interface to the MCU uses the familiar I2C bus for easy integration.

Figure 4: Security Commands Available on the Atmel ATSHA204A. (Courtesy of Atmel Corp)

Conclusion

Ethernet is here to stay and with low-end MCUs now supporting wired Ethernet connectivity, embedded IoT devices will be able to use the performance and reliability provided by a wired connection. Make sure you match Ethernet capabilities required by your application to the features offered by your target MCU for a successful design.

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

Supplier