We connect a new chip from WIZnet: W5500. IP for small things

    It seems that Etherent and TCP / IP are still the most common way to connect a wide variety of devices. Although WiFi has recently been gradually replacing the wired “copper” Etherent, finding a port and plugging into a LAN is still the easiest way to connect. Such accessibility of Ethernet did not pass by even the smallest pieces of hardware: controllers, sensors, consumption meters, etc. which are now called the fashionable marketing word " Internet Of Things * " (Internet Of Things, IoT).



    And here Korean WIZnet microcircuits can help us a lot. WIZnet is a fairly active manufacturer of IOcP (Internet Offload co-Processor) class chips. What is it? In human terms, this is a chip that: on the one hand has Etherent, inside contains its own tiny processor for processing TCP / IP, and on the other hand - a simple interface for communicating with our small piece of hardware.

    In the first part there will be a small theoretical overview of connecting "small glands" and a bunch of links to different chips.

    But the question immediately arises: WHY introduce another processor into the system, if everything can be processed on the main? Let's try to answer.

    Overview: Ethernet for little things.


    Let's try to go “down” on the scale of value (to units of dollars or even lower) and consider various ways to include “little things” in the network.

    The easiest and easiest way to get to the network for microcontrollers is to use COMport-to-Telnet and Serial2Ethernet converters, sometimes also called Reverse Telnet. In this case, the converter “catches” the telnet session and “pushes” it into the regular COM port of the microcontroller. Next, the operator gets into a regular dialogue, only over the network. Well what can I say? Firstly, there is also a separate microcontroller and the devices are not cheap at all (Articles about the home-made module and about the Tibbo module) For the simple task of "changing / reading one parameter" this may well be enough. There are many disadvantages too - a single session, a fixed protocol - it is difficult, for example, to screw SSL if it is not there, the complexity of configuring the converter itself , for example, changing its IP address or port, etc.

    Another option is microcontrollers with real Etherent on board, but they usually only have a MAC level and require an external PHY chip (KS8721BL, DM9161A, RTL8201). Connection with such a chip, MII or RMII requires at least external pins. To connect PHY with LAN, you still need to solder the transformer or MagJack. Thus, according to the “number of components”, there is no gain here. Surprisingly, external Etherent PHYs are quite expensive chips, a few dollars per case. But about the same costthe whole chip from WIZnet as a whole, silicon in mass production costs a penny. Yes, a transformer for WIZnet is also required, but a significant gain from the built-in MAC-controller at a price will not work. Second: software support for MAC / PHY is quite complex and voluminous. For example, for STM32Fxx7, the source code for an Ethernet driver occupies approximately 100K of text in C. ( article about PICs with Ether ). In addition to the Etherent driver , the TCP / IP stack itself ( LwIP or uIP ) is also needed . In addition to size, do not forget about the speed of execution (although ... STM32 is already faster than the first Pentium in speed and you can forget about performance limitation).

    But are there any advantages of a “full” software IP stack on a microcontroller? Of course have. We will consider them later, but for now we continue.

    The third option is the Microchip ENC28J60 controller SPI Ethernet chip (and a little less well-known Silabs CP2200 ) , which is deeply loved by the "embedders" . Please note that these are real Ethernet controllers , not TCP / IP coprocessors. All that a chip can do is receive and receive Etherent frames. That is, you still have to do the TCP / IP stack yourself. Yes, there are several ready-made stacks, from wonderful small ones to classic LwIP and uIP.

    But still, such a solution is more likely to directly compete with the built-in MAC controller, and the chip price is the same a few dollars and about $ 5..7 for a ready-made module (board with a chip, transformer and RJ45 socket) on ebay / aliexpress. So back to WIZnet products.

    WIZnet: the middle way.


    The first W3100 device was released a long time ago, in 2001. It was a full-fledged TCP / IP IOcP (coprocessor), which offered a certain middle way between the COM port and the MAC controller, realizing the idea of ​​TCP / UDP "sockets" inside the chip. Physically, the W3100 was not a very convenient dual-chip MAS / PHY kit and the real popularity among the “arduino drivers” (AVR) and “pico-guides” came to the W5100 device . Suffice it to say that the “official” Arduino Ethernet Shield is assembled specifically on the W5100.

    Since then, a lot of time has passed and the W5100's shortcomings have become noticeable: the chip heats up pretty much, the network speed is only 10Mbit / s, the chip has several (documented in Errata) glitches, the case is quite large due to the presence of a parallel bus, somewhat non-trivial implementation of SPI. Not surprisingly, WIZnet soon introduced the following model: W5200 . This chip learned to work at 100Mbit, to fall asleep and save electricity, lost parallel connection, it remained purely SPI, which sharply reduced the number of legs. (To support the parallel bus, he has a "brother" W5300).

    Implementation and development of W5200 went off with a bang! and continues to this day, modules are produced (starting from the "native" WizNET WIZ820io) and ending with various Arduino shields, those who wish can easily find them. For example, a little less “official” Ethernet Shield V2.0 from the Seeeduino project or Ethernet Shield for Arduino from Dfrobot. And then there’s a large list of other modules (the list is really big, scroll down).

    And finally, in October 2013 WIZnet announced a new W5500 about which it was actually planned to tell in this article (sorry for such a protracted introduction). The chip received a
    48LQFN case, a little more convenient for LUT-do-it-yourselfers, a fast "packet" SPI and Cortex M0 inside, which allowed to reduce the manufacturing process and power consumption. In general, the chip looks like "W5200 on steroids."Comparison of W5200 and W5500 .

    Following WizNET released module WIZ550io (there is and circuit), and not to stay away from "arduinomanii" soon she herself WIZnet released yet and Arduino Shield (this is a passive adapter with Arduino on WIZ550io).

    But let's not consider Arduino, it will do it without us (for example, right here on Habré: an Ethernet thermometer based on Arduino , etc.) and try to fasten the W5500 to some popular microcontroller, for example, the STM32 as well. Even WizNET itself is aware of this wonderful family and released the W5200E01-M3 module .on the previous W5200 (STM32F103C8 and FT232RQ for USB2Serial). Soon, the module on the STM32 + W5500: WIZ550web came out .

    Incidentally, in March 2014 on Circuitcellar competition was announced the Connect of The Magic (to August 2014) for the development using the W5500, and the WIZnet has thrown off the price of chips and modules ( buy ). In the competition, you could win up to $ 15,000. Details on the site, there is an excellent article there .

    In the second part (if I add it ...) we will try to screw the W5500 (or rather WIZ550io) to a small debug board from Shenzhen LC Technology Co., Ltd. and win $ 15,000 . Shawls sold on Aliexpress for $ 7.99 and were even mentioned several times on Habré.


    PS The author has nothing to do with the reputable company WIZnet, but gradually the list of links on the W5500 has grown and turned into such a hub.

    Also popular now: