The Transmission Control Protocol/Internet Protocol (TCP/IP) is the World Wide Web’s communication language, which can also be used on private networks such as an intranet and extranet. Every computer on the planet will be required to have a copy of the TCP/IP program so you can access the internet, which allows you to send or receive messages and information.
The language is basically created from a two-layer program: The Transmission Control Protocol (the higher layer) and the Internet Protocol (the lower layer). You may recognize HTTP, FTP or SMTP, which form part of the higher layer that places a file or direct message into a file and transmits it via the internet, which is received by a TCP layer on another device, that packets the original message. Meanwhile, the lower layer manages the message or file address to ensure it reaches the correct destination.
Many people are often surprised to learn they can integrate Transmission Control Protocol/Internet Protocol (TCP/IP) stack onto a microcontroller, despite the fact, the process has been available for many years.
Suppliers can provide the free implementation of a TCP/IP stack, which is a program suite that offers services to standard TCP/IP-based applications, such as an HTTP server. Alternatively, the service can be used for a customized TCP/IP application.
The TCP/IP Stack Architecture
The implementation of the TCP/IP stack will more than likely follow a software architecture, which is regularly referred to as the TCP/IP Reference Model. The model divides the software into various layers, which are stacked on top of each other – which is the reason behind the name TCP/IP stack. Every layer will access a service from another layer below it. For example, the application (Layer 1) will access transport (layer 2), which accesses the internet (layer 3) that then access the layer below it, the host-to-network (layer 4).
Depending on the stack’s specifications, many of the TCP/IP layers will be live, meaning they will only spring into action once their service has been requested by another layer, or when an event like a time-out arises. A microcontroller can, therefore, incorporate a TCP/IP stack when you opt for a system with the right level of data memory and program memory.
Let’s use the Microchip free licensed stack as the perfect example, which is similar to the TCP/IP reference model, as it divides the TCP/IP stack into multiple layers. The code belonging to each layer will be located within a separate source file, while the Application Programming Interfaces (APIs) will be featured within the header/include files.
However, in contrast to the TCP/IP reference model, Microchip’s intelligent stack has additional layers, which can be by bypassed, as a layer can bypass an adjacent module for the services it requires. The additional layers can manage the general operations of the stack’s modules, as well as the services of the Address Resolution Protocol (ARP) layer. The stack, therefore, used cooperative multitasking to ensure the layers can asynchronously perform their timed operations. Each layer will, therefore, perform a function, before returning the control to allow the next layer to perform its job. The stack has been innovatively designed to be independent of another operating system so that you can be used in any system, but it must use the cooperative multitasking process, which is done by either:
- Organizing a primary job into a Finite State Machine (FSM)
- Dividing a job into multiple tasks
- Dividing a long task into smaller jobs
The TCP/IP stack can support TCP and UDP transport layer modules, IPv4 internet layer modules and ARP link layer modules, as well a range of application layer modules. The MAC/PHY chip hardware will also provide the Media Access Control link layer functionality.
The Memory Size
Memory size is bound to be a concern when it comes to a microcontroller. The TCP/IP stack memory will be determined by the compiler and modules selected. You should, therefore, discuss your needs and memory size with the supplier.
In conclusion, the TCP/IP stack is a space-saving, modular version of the ground-breaking TCP/IP reference model, which can adapt to various firmware availability. The TCP/IP stack can, therefore, prove to be an effective no-cost software solution for developing applications when embedded control requires a network connection.
So, if you are considering the implementation of Transport Control Protocol/Internet Protocol into a microcontroller, you should contact a reputable supplier of microcontrollers. Opt for a lightweight, high performing TCP/IP implementation of UDP and TCP transport layers, in addition to varying supporting modules, including DNS, IP, ICMP, DHCP, and ARP.