SPMA072 March 2015 TM4C1294KCPDT , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1294NCZAD , TM4C1299KCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C1299NCZAD , TM4C129EKCPDT , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129ENCZAD , TM4C129XKCZAD , TM4C129XKCZAD , TM4C129XNCZAD , TM4C129XNCZAD
The main function of the enet_s2e application is to transfer information between serial peripherals and the Ethernet. To transfer information over the Ethernet, Telnet protocol is used. A number of features are provided in the application to make this process easy to use and robust. The following are some of these features.
The application runs a webserver to manage the dynamic/run-time configuration of many parameters. For more details of the configuration webserver and the different settings, see Section 5.2.
This application uses two serial peripherals and two Telnet ports. The serial peripheral and Telnet port are configured such that each serial peripheral can transmit and receive data to and from only one Telnet port. There are two such serial-Telnet pairs, represented by Port0 and Port1. By default, the serial interface of Port0 and Port1 are assigned to UART4 and UART3 peripherals, respectively. This default peripheral assignment can be modified in config.h file. If the default peripheral assignment is modified, then the assignment of the interrupt handlers SerialPort0IntHandler and SerialPort1IntHandler in the vector table should also be modified. The vector table is located in the start-up file.
The Telnet ports can be configured in both server and client modes along with the necessary parameters like port number and IP address. By default, both the Telnet ports are configured as server. The Telnet ports used by Port0 and Port1 are 23 and 26, respectively.
Port0 and Port1 settings can be modified dynamically. You also have an option to make these modifications permanent. For more details about these settings, see Section 5.2.2. The default values of these settings are stored in the global array g_sParametersFactory (present in the config.c file).
The enet_s2e application uses FreeRTOS to run multiple tasks in a concurrent fashion, a TCP/IP stack, called lwIP, to handle the TCP/IP packets and TivaWare for C Series that includes peripheral driver library and other utilities that simplify application development. Figure 1 shows the interaction between different software layers of this application.
The enet_s2e.c file contains the main function and performs the initialization before handing over control to the FreeRTOS scheduler. The tasks and their responsibilities are as follows:
The TCP/IP task and Ethernet task are created and managed by the lwIP library.
The data transfer between the serial peripherals and telnet sockets is handled by the TelnetHandler() function (present in telnet.c file), which is called by lwIPHostTimerHandler() function (present in lwip_task.c file). The lwIPHostTimerHandler() function runs in the TCP/IP task context.