Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS - Libero SoC V11.7 DG0472 Demo Guide Contents 1 Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 1.2 1.3 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.1 Microsemi Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.2 Others . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5 5 5 2 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 2.2 2.3 2.4 2.5 2.6 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1.1 Webserver and TFTP Server Applications on SmartFusion2 Devices . . . . . . . . . . . . . . . . . . . 6 2.1.1.1 Application Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1.2 Transport Layer (lwIP TCP/IP Stack) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1.3 RTOS and Firmware Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Design Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Demo Design Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.4.1 Demo Design Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.4.1.1 Libero SoC Hardware Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.4.1.2 SoftConsole Firmware Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Setting Up the Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5.1 Board Setup Snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Running the Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.6.1 Running Webserver Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.6.2 Running TFTP Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3 Appendix: Board Setup for Running the Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4 Appendix: Jumper Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5 Appendix: Running the Design in Static IP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . 30 6 Appendix: Running the SoftConsole Project in Debug Mode . . . . . . . . . . . . . . . . . 34 7 Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8 Product Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 8.1 8.2 8.3 8.4 8.5 8.6 Customer Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Contacting the Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.1 Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.2 My Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.3 Outside the U.S. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ITAR Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Revision 6 37 37 37 37 37 37 37 38 38 2 Figures Figure 1. Figure 2. Figure 3. Figure 4. Figure 5. Figure 6. Figure 7. Figure 8. Figure 9. Figure 10. Figure 11. Figure 12. Figure 13. Figure 14. Figure 15. Figure 16. Figure 17. Figure 18. Figure 19. Figure 20. Figure 21. Figure 22. Figure 23. Figure 24. Figure 25. Figure 26. Figure 27. Figure 28. Figure 29. Figure 30. Figure 31. Figure 32. Figure 33. Figure 34. Figure 35. Figure 36. Block Diagram of Webserver and TFTP Server Applications on SmartFusion2 . . . . . . . . . . . . . . . . 7 Demo Design Files Top Level Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Libero Top-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 High Speed Serial Interface Configurator Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 SoftConsole Project Explorer Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Device Manager Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 FlashPro New Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 FlashPro Project Configured . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 FlashPro Program Passed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 HyperTerminal with IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Main Menu of Webserver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Selecting RTC and Ethernet Interface Data Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Webserver RTC and Ethernet Interface Data Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Selecting Blinking LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Blinking LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Selecting HyperTerminal Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Webserver HyperTerminal Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 String Display on HyperTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Selecting SmartFusion2 Google Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Webserver SmartFusion2 Google Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Enabling TFTP Client in Host PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Windows Firewall Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 HyperTerminal with Welcome Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 HyperTerminal with IP Address - Erasing SPI Flash Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 HyperTerminal with IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Command Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Successful Transfer Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 HyperTerminal with Available SPI Flash Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 SmartFusion2 Advanced Development Kit Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 SmartFusion2 Advanced Development Kit Silkscreen Top View . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Project Explorer Window of SoftConsole Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Webserver_TCP_App Properties Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Host PC TCP/IP Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Static IP Address Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Debug Configurations for TFTP_Server_Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Debug Configurations for Webserver_TCP_App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Revision 6 3 Tables Table 1. Table 2. Table 3. Table 4. Design Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 LED to Package Pins Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 PHY Interface Signals to Package Pins Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 SmartFusion2 Advanced Development Kit Jumper Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Revision 6 4 Preface 1 Preface 1.1 Purpose This demo is for SmartFusion®2 system-on-chip (SoC) field programmable gate array (FPGA) devices. It provides instructions on how to use the corresponding reference design. 1.2 Intended Audience This demo guide is intended for: • • • FPGA designers Embedded designers System-level designers 1.3 References 1.3.1 Microsemi Publications See the following web page for a complete and up-to-date listing of SmartFusion2 device documentation: http://www.microsemi.com/products/fpga-soc/soc-fpga/sf2docs • • • • 1.3.2 UG0331: SmartFusion2 Microcontroller Subsystem User Guide UG0447: IGLOO2 and SmartFusion2 High Speed Serial Interfaces User Guide Libero SoC User Guide UG0557: SmartFusion2 SoC FPGA Advanced Development Kit User Guide Others The following documents are referred in this demo guide. • • lwIP TCP/IP stack: • www.sics.se/~adam/lwip/ • http://download.savannah.gnu.org/releases/lwip/ FreeRTOS™ stack: www.freeRTOS.org Revision 6 5 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2.1 Introduction This demo design explains the tri-speed ethernet medium access controller (TSEMAC) features of the SmartFusion2 device and implements the Webserver, trivial file transfer protocol (TFTP) server application on UG0557: SmartFusion2 SoC FPGA Advanced Development Kit User Guide. This demo describes the following: • • • • • Use of SmartFusion2 Ethernet MAC connected to a serial gigabit media independent interface (SGMII) PHY. Integration of SmartFusion2 MAC driver with the lwIP TCP/IP stack and the FreeRTOS operating system. Implementation of Webserver on the SmartFusion2 Advanced Development Kit board. Implementation of TFTP server on the SmartFusion2 Advanced Development Kit board. Procedure to run the Webserver and TFTP server designs on the SmartFusion2 Advanced Development Kit board. The microcontroller subsystem (MSS) of the SmartFusion2 device has an instance of the TSEMAC peripheral. The TSEMAC can be configured between the host PC and the Ethernet network at the following data transfer rates (line speeds): • • • 10 Mbps 100 Mbps 1000 Mbps See the UG0331: SmartFusion2 Microcontroller Subsystem User Guide for more information on the TSEMAC interface for SmartFusion2 devices. 2.1.1 Webserver and TFTP Server Applications on SmartFusion2 Devices The Webserver and TFTP server demo designs consist of the following layers: • • • Application Layer Transport Layer (lwIP TCP/IP Stack) RTOS and Firmware Layer Revision 6 6 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS Figure 1 shows the block diagram of the Webserver and TFTP server applications on the SmartFusion2 device. Figure 1 • Block Diagram of Webserver and TFTP Server Applications on SmartFusion2 Application Layer (HTTP, TFTP) Transport Layer (lwIP TCP/IP Stack) FreeRTOS Firmware Layer SmartFusion2 Advanced Development Kit (HW) 2.1.1.1 Application Layer The Webserver and TFTP server applications are implemented on the SmartFusion2 Advanced Development Kit board. Webserver handles the HTTP request from the client browser and transfers the static pages to the client in response to their request. These pages run on the client (host PC) browser. When the URL with IP address (for example, http://10.60.3.25) is typed in the browser, the HTTP request is sent to the port on the Webserver. The Webserver then interprets the request and responds to the client with the requested page or resource. The TFTP client (host PC) transfers the file using TFTP PUT command to the SmartFusion2 device (TFTP server). Transferred files are stored in the external flash memory on the SmartFusion2 Advanced Development Kit. External flash memory is interfaced to SmartFusion2 SPI_0. Fat file system on SPI flash is used to display the files available in SPI flash memory. 2.1.1.2 Transport Layer (lwIP TCP/IP Stack) lwIP TCP/IP stack was developed by Adam Dunkels at the Swedish Institute of Computer Science (SICS). The lwIP stack is suitable for the embedded systems because of less resource usage. It can be used with or without the operating system. The lwIP consists of the actual implementations of the IP, ICMP, UDP, and TCP protocols, as well as the support functions such as buffer and memory management. For more information on the design and implementation, see www.sics.se/~adam/lwip/doc/lwip.pdf. The lwIP is available (under a BSD license) in C source-code format for download from the following path: http://download.savannah.gnu.org/releases/lwip/ 2.1.1.3 RTOS and Firmware Layer FreeRTOS is an open source real time operating system kernel. FreeRTOS is used in this demo to prioritize and schedule the tasks. See http://www.freertos.org for more information and the latest source code. The firmware provides the software driver implementation to configure and control the following MSS components: • • • • • Ethernet MAC MMUART GPIO SPI RTC Revision 6 7 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2.2 Design Requirements Table 1 lists the hardware and software design requirements. Table 1 • Design Requirements Design Requirements Description Hardware Requirements SmartFusion2 Advanced Development Kit • 12 V adapter • FlashPro5 • USB A to Mini-B cable Rev A or later RJ45 cable – Host PC or Laptop Windows 64-bit Operating System Software Requirements Libero® System-on-Chip (SoC) for viewing the design files v11.7 FlashPro Programming Software v11.7 SoftConsole v3.4 SP1* Host PC Drivers USB to UART drivers One of the following serial terminal emulation programs: HyperTerminal TeraTerm PuTTY – Browser Mozilla Firefox or Internet Explorer Note: *For this tutorial, SoftConsole v3.4 SP1 is used. For using SoftConsole v4.0, see the TU0546: SoftConsole v4.0 and Libero SoC v11.7 Tutorial. 2.3 Demo Design 2.3.1 Introduction The demo design files are available for download from the following path in the Microsemi website: www.microsemi.com/soc/download/rsc/?f=m2s_dg0472_liberov11p7_df The demo design files include: • • • • Libero SoC hardware project with SoftConsole firmware project Sample files Programming files Readme.txt file Revision 6 8 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS Figure 2 shows the top-level structure of the design files. For further details, see the Readme.txt file. Figure 2 • Demo Design Files Top Level Structure GRZQORDGBIROGHU! 6)B:HEVHUYHUB7IWSB7&3B'HPRB') /LEHUR 3URJUDPPLQJ)LOHV VDPSOHBILOHV 5HDGPHW[W 2.4 Demo Design Features The demo has the following options: • • 2.4.1 Webserver • RTC and Ethernet Interface data display • Blinking LEDs • HyperTerminal Display • SmartFusion2 Google Search TFTP server • Transfers files from the host PC to the SmartFusion2 Advanced Development Kit Demo Design Description The demo design is implemented using a SGMII PHY interface by configuring the TSEMAC for the ten-bit interface (TBI) operation. For more information on the TSEMAC TBI interface, see the UG0331: SmartFusion2 Microcontroller Subsystem User Guide. The demo design comprises of: • • Libero SoC Hardware Project SoftConsole Firmware Project Revision 6 9 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2.4.1.1 Libero SoC Hardware Project Figure 3 shows the Libero SoC hardware design implementation for this demo design. Figure 3 • Libero Top-Level Design Libero hardware project uses the following SmartFusion2 MSS resources and IPs: • • • • • TSEMAC TBI interface MMUART_0 for RS-232 communications on the Advanced Development Kit. SPI_0: To access external Flash memory. COREAHBLSRAM: For TFTP application stack. General purpose input and output (GPIO): Interfaces the light emitting diodes (LEDs) Revision 6 10 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 1. High speed serial interface (SERDESIF) SERDES_IF IP: Configured for SERDESIF_3 EPCS lane3 as shown in Figure 4. For more information on high-speed serial interfaces, see the UG0447: IGLOO2 and SmartFusion2 High Speed Serial Interfaces User Guide. Figure 4 • High Speed Serial Interface Configurator Window Revision 6 11 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2.4.1.1.1 Package Pin Assignments Package pin assignments for LEDs and PHY interface signals are shown in Table 2 and Table 3. Table 2 shows the port names for the package pins. Table 2 • LED to Package Pins Assignments Port Name Package Pin LED_1 D26 LED_2 F26 LED_3 A27 LED_4 C26 LED_5 C28 LED_6 B27 LED_7 C27 LED_8 E26 Table 3 lists the port names and directions for the package pins. Table 3 • PHY Interface Signals to Package Pins Assignments Port Name Direction Package Pin PHY_MDC Output F3 PHY_MDIO Input K7 PHY_RST Output F2 2.4.1.2 SoftConsole Firmware Project Invoke the SoftConsole project using Standalone SoftConsole IDE. The following stacks are used for this demo design: • • lwIP TCP/IP stack version 1.4.1 (www.sics.se/~adam/lwip/) FreeRTOS (www.freertos.org) Figure 1 on page 7 shows the block diagram of the Webserver and TFTP server applications on the SmartFusion2 device used in this demo design. Revision 6 12 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS Figure 5 shows SoftConsole software directory structure of the demo design. Figure 5 • SoftConsole Project Explorer Window Revision 6 13 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS The SoftConsole workspace consists of the following three projects. • • TFTP_Server_Application: Contains TFTP server application using LWIP, FreeRTOS, and FatFs. Webserver_TCP_App: Contains Webserver application implementation using LWIP and FreeRTOS. • Webserver_TCP_MSS_CM3_hw_platform: Contains all the firmware and hardware abstraction layers that correspond to the hardware design. This project is configured as a library and is referenced by Webserver_TCP_App and TFTP_Server_Application projects. The contents of this folder get overwritten every time the root design is regenerated in the Libero SoC software. Note: To run the SoftConsole project in debug mode, see "Appendix: Running the SoftConsole Project in Debug Mode" on page 34. 2.5 Setting Up the Demo Design The following steps describe how to setup the demo for SmartFusion2 Advanced Development Kit board: 1. Connect the host PC to the J33 Connector using the USB A to mini-B cable. The USB to UART bridge drivers are automatically detected. 2. From the detected four COM ports, right-click any one of the COM ports and select Properties. The selected COM port properties window is displayed, as shown in Figure 6. 3. Ensure to have the Location as on USB FP5 Serial Converter C in the Properties window as shown in Figure 6. Note: Make a note of the COM port number for serial port configuration and ensure that the COM port Location is specified as on USB FP5 Serial Converter C. Figure 6 • Device Manager Window 4. 5. Install the USB driver if the USB drivers are not detected automatically. Install the FTDI D2XX driver for serial terminal communication through the FTDI mini USB cable. Download the drivers and installation guide from: www.microsemi.com/soc/documents/CDM_2.08.24_WHQL_Certified.zip Revision 6 14 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 6. Connect the jumpers on the SmartFusion2 Advanced Development Kit board as shown in Table 4. For information on jumper locations, see "Appendix: Jumper Locations" on page 29. Caution: Switch OFF the power supply switch, SW7, before making the jumper connections. Table 4 • SmartFusion2 Advanced Development Kit Jumper Settings Jumper Pin (From) Pin (To) Comments J116, J353, J354, J54 1 2 J123 2 3 These are the default jumper settings of the Advanced Development Kit Board. Ensure these jumpers are set accordingly. J124, J121, J32 1 2 JTAG programming via FTDI J118, J119 1 2 Programming SPI Flash 7. 8. 2.5.1 Connect the power supply to the J42 connector in the SmartFusion2 Advanced Development Kit. This design example can run in both Static IP and Dynamic IP modes. By default, programming files are provided for dynamic IP mode. • For static IP, connect the host PC to the J21 connector of the SmartFusion2 Advanced Development Kit board using an RJ45 cable. • For dynamic IP, connect any one of the open network ports to the J21 connector of the SmartFusion2 Advanced Development Kit board using an RJ45 cable. Board Setup Snapshot Snapshots of the SmartFusion2 Advanced Development Kit board with all the setup made is given in "Appendix: Board Setup for Running the Demo" on page 28. 2.6 Running the Demo Design 1. Download the demo design from: www.microsemi.com/soc/download/rsc/?f=m2s_dg0472_liberov11p7_df 2. Switch ON the SW7 power supply switch. 3. Start any serial terminal emulation program such as: • HyperTerminal • PuTTY • TeraTerm Note: In this demo HyperTerminal is used. The configuration for the program is: • Baud Rate: 115200 • Eight data bits • One stop bit • No Parity • No flow control For information on configuring the serial terminal emulation programs, see the Configuring Serial Terminal Emulation Programs Tutorial. Revision 6 15 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2.6.1 Running Webserver Demo The following steps describe how to run the Webserver Demo: 1. 2. 3. Launch the FlashPro software. Click New Project. In the New Project window, enter the project name. Figure 7 • FlashPro New Project 4. 5. 6. 7. Click Browse and navigate to the location where the project is required to be saved. Select Single device as the Programming mode. Click OK to save the project. Click Configure Device. Revision 6 16 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 8. Click Browse and navigate to the location where the Webserver_TCP_top.stp file is located and select the file. The default location is: <download_folder>\SF2_Webserver_Tftp_TCP_Demo_DF\ProgrammingFiles\webserver\Webserve r_TCP_top.stp. The required programming file is selected and is ready to be programmed in the device. Figure 8 • FlashPro Project Configured Revision 6 17 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 9. Click PROGRAM to start programming the device. Wait until a message is displayed indicating that the program has passed. Figure 9 • FlashPro Program Passed Note: The demo can be run in static and dynamic modes. To run the design in Static IP mode, follow the steps mentioned in the "Appendix: Running the Design in Static IP Mode" on page 30. Revision 6 18 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 10. Power cycle the SmartFusion2 Advanced Development board. A welcome message with the IP address is displayed in the HyperTerminal window, as shown in Figure 10. Figure 10 • HyperTerminal with IP Address The IP address displayed on the HyperTerminal must be entered in the address bar of the browser (Mozilla Firefox) to run the Webserver. The main menu of the Webserver is shown in Figure 11. Figure 11 • Main Menu of Webserver Revision 6 19 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 11. Click RTC and Ethernet Interface data display on the main menu of the Webserver demo. Figure 12 • Selecting RTC and Ethernet Interface Data Display Figure 13 shows a webpage with RTC values and Ethernet MAC properties. Figure 13 • Webserver RTC and Ethernet Interface Data Display Revision 6 20 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 12. Click Home to go back to the main menu. 13. Click Blinking LED’s on the main menu. Figure 14 • Selecting Blinking LEDs Figure 15 shows a running LED pattern on the board. The webpage gives an option to enter the values to blink the LEDs manually. 14. Enter any number between 1-255 to toggle the LEDs manually. For example, if 1 is entered, LED1 goes OFF. If 255 is entered, all the eight LEDs go OFF. Note: The SmartFusion2 Advanced Development Kit has Active Low LEDs. Figure 15 • Blinking LEDs Revision 6 21 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 15. Click Home to go back to the main menu. 16. Click HyperTerminal Display on the main menu. Figure 16 • Selecting HyperTerminal Display Figure 17 shows a webpage that gives an option to enter a string value. Figure 17 • Webserver HyperTerminal Display The entered string is displayed on HyperTerminal as shown in Figure 18. Figure 18 • String Display on HyperTerminal Revision 6 22 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 17. Click Home to go back to the main menu. 18. Click SmartFusion2 Google Search on the main menu. Figure 19 • Selecting SmartFusion2 Google Search Note: Internet connection is required with proper access rights to get to the SmartFusion2 Google Search page. Figure 20 shows a webpage with Google search option. Figure 20 • Webserver SmartFusion2 Google Search 19. Click Home to go back to the main menu. Revision 6 23 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2.6.2 Running TFTP Demo The following steps describe how to run the TFTP demo: 1. To enable the TFTP client in the host PC, navigate to Control Panel > Programs. Click Turn Windows Features On or Off and select the TFTP client in Windows Features as shown in Figure 21. Figure 21 • Enabling TFTP Client in Host PC Revision 6 24 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 2. Navigate to Control Panel > Windows Firewall and click Turn Windows Firewall On or Off. Select Turn off Windows Firewall under Domain network location settings as shown in Figure 22. Figure 22 • Windows Firewall Settings 3. Launch the FlashPro software and program the device with <download_folder>\SF2_Webserver_Tftp_TCP_Demo_DF\ProgrammingFiles\Tftp_Server\Webserv er_TCP_top_tftp.stp. Wait until a message indicating that the program passed is displayed. See Step 1. to Step 9. of "Running Webserver Demo" section on page 16. Note: To run the design in static IP mode, follow the steps mentioned in the "Appendix: Running the Design in Static IP Mode" on page 30. 4. Power cycle the SmartFusion2 Advanced Development Kit board. HyperTerminal program displays the welcome message and option to clear the SPI Flash contents as shown in Figure 23. Figure 23 • HyperTerminal with Welcome Message Revision 6 25 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 5. Type y to erase the SPI Flash memory contents, as shown in Figure 24. Figure 24 • HyperTerminal with IP Address - Erasing SPI Flash Memory 6. Type any key other than y to skip SPI Flash erasing, as shown in Figure 25. The HyperTerminal program displays the dynamic IP address also, as shown in Figure 24 or Figure 25. Figure 25 • HyperTerminal with IP Address 7. Open the command prompt in the host PC and navigate to the directory, where the files to be transferred to the SPI FLASH are located: <download_folder>\SF2_Webserver_Tftp_TCP_Demo_DF\sample_files. Revision 6 26 Running Webserver and TFTP Server on SmartFusion2 Device Using IwIP and FreeRTOS 8. Type the following tftp command to transfer the file to the tftp server (SmartFusion2 Device) as shown in Figure 26. tftp -i < ip address> PUT <file name> Figure 26 • Command Prompt On successful file transfer from the host PC to the SmartFusion2 SPI-Flash, the command prompt window shows the transfer successful message, as shown in Figure 27. Figure 27 • Successful Transfer Message HyperTerminal shows the available files in SPI flash, as shown in Figure 28. Figure 28 • HyperTerminal with Available SPI Flash Files 9. Repeat Step 7. and Step 8., if another file is required to be transferred to the SmartFusion2 SPI-Flash from host PC. 10. After running the demo, close the HyperTerminal. Revision 6 27 Appendix: Board Setup for Running the Demo 3 Appendix: Board Setup for Running the Demo Figure 29 shows the board setup for running the demo on the SmartFusion2 Advanced Development Kit board. Figure 29 • SmartFusion2 Advanced Development Kit Setup Revision 6 28 Appendix: Jumper Locations 4 Appendix: Jumper Locations Figure 30 shows the jumper locations on the SmartFusion2 Advanced Development Kit board. Figure 30 • SmartFusion2 Advanced Development Kit Silkscreen Top View R1217 2 H1 DS21 R318 R362 C604 J121 J124 R161 J125 DS0 DS1 DS2 J351 R253 H40 10 J37 9 20 J32 J60 19 2 20 J38 1 19 R162 R330 C596 R260 U34 U23 C1 H1 R255 C600 C332 U25 TP3 TP7 TP20 R155 TP4 R283 R282 C697 C696 J123 J29 U59 U31 R267 DS16 C40 1 J36 C610 R279 R278 R276 D7 TP16 U24 SW1 2 J28 C638 R304 TP12 R151 R147 SW4 B 1 D9 C593 R148 DS20 SW3 A R306 C636 R305 C637 J119 B SW2 TP35 D8 DS3 DS5 DS4 B A TP21 TP9 R152 2 3 DS29 R354 R1216 1 2 3 4 5 6 7 8 R369 DS18 DS19 R364 R159 R158 R316 R314 DS7 DS6 R149 C328 R363 R361 C467 C460 C455 A R272 C608 R366 B DS17 R292 DS25 1 Y11 6 A DS23 DS24 3 2 J116 DS22 1 U35 TP10 TP22 U32 C647 R310 R338 R277 C698 U5 Y12 R220 C119 C161 C562 C233 C197 C118 C163 C468 C519 R1213 A1 U3 R337 R47 R48 R307 U2 U13 C645 C646 C644 C641 C642 A1 R336 U7 R222 R224 C109 C150 C236 C235 C199 C159 C116 C465 Y4 C371 TP74 R211 C153 C156 Y3 R1214 R1215 R1209 R1212 R1208 R1210 R1207 A1 R150 A1 TP60 R210 TP53 TP68 TP41 R335 5 C691 TP11 C630 C643 C648 R311 R309 TP66 U6 CON1 B1 R213 R209 R346 SW5 R308 C640 TP27 MH2 C518 R266 J353 R332 R351 R352 R355 R356 TP70 TP64 R217 C476 J118 TP73 C211 C210 C213 C212 C136 C135 C138 C137 C140 C139 C142 C141 C173 C172 C175 C174 C177 C176 C179 C178 C216 C215 C92 C91 C94 C93 C96 C95 C484 C554 C530 C528 C526 C625 C394 C521 TP26 C463 C422 R375 R1211 C599 Y20 R344 R345 SW7 TP17 R281 R280 R300 U26 U27 R808 C705 C703 C704 R353 R160 R977 R973 R974 C382 U60 A1 R288 C359 R378 U4 A1 C517 TP58 TP72 TP62 TP77 C374 L6 R343 J10 C113 C129 J13 TP49 C220 TP67 C362 TP56 R70 C360 C361 U1 TP29 L5 TP28 C702 J6 R286 C671 C674 C624 R839 U9 R131 U11 C701 C700 C672 R840 R841 R842 R126 R373 R294 C699 R374 R289 R134 C315 R138 R130 R125 R133 U10 A1 J17 J354 R143 R137 R139 R141 U12 J23 J16 C324 C325 U49 C606 R396 TP1 R127 CR2 CR1 R136 C323 TP2 C316 5 C164 R298 1 P1 C605 R140 R142 DS26 C673 R111 R112 R78 C330 C331 R74R72 J18 R73 R71 C257 C246 C292 J21 C283 R81 R76 Y2 R293 R303 R75 R114 C306 C282 R113 J15 U62 U8 R156 R372 C313 R79 U37 C302 C314 R92 R91 R94 R93 R95 R96 R121 R120 R115 R110 R109 R108 R106 R107 C626 R98 R97 C307 C308 C297 C295 C293 J12 R54 R55 R69 U58 J11 J9 J5 J4 C471 J22 C98 TP15 R104 R105 J7 C148 R64 C181 C183 R60 TP54 TP33 TP57 TP39 R59 TP50 TP69 R58 C144 C146 TP42 TP44 TP76 R216 C102 C100 R42 TP40 R41 TP38 C103 TP36 TP51 C209 R40 C294 A1 C296 C89 C90 C305 C304 TP75 R218 TP78 C378 J20 R100 R99 R1518 R290 R291 C303 TP71 TP46 4 R313 C692 J8 TP48 TP31 R63 R331 J14 TP30 J42 R301 J350 J54 D15 TP24 R46 L4 J19 C1575 C1574 C1573 C1572 C1566 U28 R50 C214 U36 TP32 R270 R978 R975 R976 R194 R193 R192 R199 R198 R197 D13 R327 R328 R326 A1 A40 R5484 R5483 R334 C1579 D14 R333 D10 DS11 DS12 DS13 DS14 DS8 DS9 DS10 MH1 U162 R179 R178 R177 C623 L3 U17 Y6 DS28 J30 C926 R116 R117 R118 R119 R101 R102 R103 U19 CR3 R191 R190 R189 R188 R184 R183 R182 R181 J352 R1519 R295 C628 K1 K40 R257 R986 R984 R985 R983 C255 CR4 U16 5 C351 1 J33 X1 R196 U18 R163 C358 C357 B LED9 C592 R164 R167 R168 R325 R169 C668 R170 C666 R166 C667 R165 R171 R172 TP23 TP14 R329 C670 R173 R174 R176 R175 B1 DS27 A C595 R243 J34 A1 SW6 B32 Note: • • • Jumpers highlighted in red are set by default. Jumpers highlighted in green must be set manually. The location of the jumpers in Figure 30 are searchable. Revision 6 29 Appendix: Running the Design in Static IP Mode 5 Appendix: Running the Design in Static IP Mode The following steps describe how to run the design in Static IP mode: 1. To run the Webserver design in Static IP mode, right-click the Webserver_TCP_App project and select Properties as shown in Figure 31. Figure 31 • Project Explorer Window of SoftConsole Project Revision 6 30 Appendix: Running the Design in Static IP Mode 2. Remove the symbol NET_USE_DHCP in Tool Settings of the Properties for Webserver_TCP_App window, as shown in Figure 32. Figure 32 • Webserver_TCP_App Properties Window Note: To run the TFTP server design in static IP mode, remove the NET_USE_DHCP symbol in the Properties window of TFTP_Server_Application, as described in Step 1. and Step 2. Revision 6 31 Appendix: Running the Design in Static IP Mode If the device is connected in Static IP mode, the board static IP address is 169.254.1.23, then change the host TCP/IP settings to reflect the IP address. Figure 33 shows Host PC TCP/IP settings. Figure 33 • Host PC TCP/IP Settings Revision 6 32 Appendix: Running the Design in Static IP Mode Figure 34 shows Static IP address settings. Figure 34 • Static IP Address Settings Once these settings are made, compile the design, load the design into memory, and run the design using the SoftConsole. Note: To run the application in debug mode, FlashPro4 JTAG programmer is required. Revision 6 33 Appendix: Running the SoftConsole Project in Debug Mode 6 Appendix: Running the SoftConsole Project in Debug Mode The following steps describe how to run the SoftConsole project in Debug mode: 1. 2. Select Debug Configurations from Run menu of the SoftConsole. The Debug Configurations dialog box is displayed. To debug TFTP_Server_Application project, select TFTP_Server_Application Debug as shown in Figure 35. Figure 35 • Debug Configurations for TFTP_Server_Application Revision 6 34 Appendix: Running the SoftConsole Project in Debug Mode 3. To debug Webserver_TCP_App project, select Webserver_TCP_App Debug as shown in Figure 36. Figure 36 • Debug Configurations for Webserver_TCP_App 4. After selecting the target click Debug. Note: To run the application in debug mode, FlashPro4 JTAG programmer is required. Revision 6 35 Revision History 7 Revision History The following table shows important changes made in this document for each revision. Revision Changes Revision 6 (March 2016) Updated the document for Libero v11.7 software release details (SAR 77020). Revision 5 (October 2015) Updated the document for Libero v11.6 software release details (SAR 72226) Revision 4 (February 2015) Updated the document for Libero v11.5 software release details (SAR 63974). Revision 3 (September 2014) Updated the document for Libero v11.4 software release details (SAR 60795). Revision 2 (March 2014) Updated the document to include TFTP server (SAR 55038). Revision 1 (December 2013) Updated the document for Libero v11.2 software release (SAR 53219). Revision 0 (October 2013) Initial Release Updated the document for SmartFusion2 Advanced Development Kit Board details (SAR 60795). Revision 6 36 Product Support 8 Product Support Microsemi SoC Products Group backs its products with various support services, including Customer Service, Customer Technical Support Center, a website, electronic mail, and worldwide sales offices. This appendix contains information about contacting Microsemi SoC Products Group and using these support services. 8.1 Customer Service Contact Customer Service for non-technical product support, such as product pricing, product upgrades, update information, order status, and authorization. From North America, call 800.262.1060 From the rest of the world, call 650.318.4460 Fax, from anywhere in the world, 408.643.6913 8.2 Customer Technical Support Center Microsemi SoC Products Group staffs its Customer Technical Support Center with highly skilled engineers who can help answer your hardware, software, and design questions about Microsemi SoC Products. The Customer Technical Support Center spends a great deal of time creating application notes, answers to common design cycle questions, documentation of known issues, and various FAQs. So, before you contact us, please visit our online resources. It is very likely we have already answered your questions. 8.3 Technical Support For Microsemi SoC Products Support, visit http://www.microsemi.com/products/fpga-soc/design-support/fpga-soc-support. 8.4 Website You can browse a variety of technical and non-technical information on the Microsemi SoC Products Group home page, at http://www.microsemi.com/products/fpga-soc/fpga-and-soc. 8.5 Contacting the Customer Technical Support Center Highly skilled engineers staff the Technical Support Center. The Technical Support Center can be contacted by email or through the Microsemi SoC Products Group website. 8.5.1 Email You can communicate your technical questions to our email address and receive answers back by email, fax, or phone. Also, if you have design problems, you can email your design files to receive assistance. We constantly monitor the email account throughout the day. When sending your request to us, please be sure to include your full name, company name, and your contact information for efficient processing of your request. The technical support email address is [email protected]. 8.5.2 My Cases Microsemi SoC Products Group customers may submit and track technical cases online by going to My Cases. Revision 6 37 Product Support 8.5.3 Outside the U.S. Customers needing assistance outside the US time zones can either contact technical support via email ([email protected]) or contact a local sales office. Visit About Us for sales office listings and corporate contacts. 8.6 ITAR Technical Support For technical support on RH and RT FPGAs that are regulated by International Traffic in Arms Regulations (ITAR), contact us via [email protected]. Alternatively, within My Cases, select Yes in the ITAR drop-down list. For a complete list of ITAR-regulated Microsemi FPGAs, visit the ITAR web page. Revision 6 38 Microsemi Corporation (Nasdaq: MSCC) offers a comprehensive portfolio of semiconductor and system solutions for communications, defense & security, aerospace and industrial markets. Products include high-performance and radiation-hardened analog mixed-signal integrated circuits, FPGAs, SoCs and ASICs; power management products; timing and synchronization devices and precise time solutions, setting the world's standard for time; voice processing devices; RF solutions; discrete components; Enterprise Storage and Communication solutions, security technologies and scalable anti-tamper products; Ethernet solutions; Power-over-Ethernet ICs and midspans; as well as custom design capabilities and services. Microsemi is headquartered in Aliso Viejo, Calif, and has approximately 4,800 employees globally. Learn more at www.microsemi.com. Microsemi Corporate Headquarters One Enterprise, Aliso Viejo, CA 92656 USA Within the USA: +1 (800) 713-4113 Outside the USA: +1 (949) 380-6100 Sales: +1 (949) 380-6136 Fax: +1 (949) 215-4996 E-mail: [email protected] © 2016 Microsemi Corporation. All rights reserved. Microsemi and the Microsemi logo are trademarks of Microsemi Corporation. All other trademarks and service marks are the property of their respective owners. Microsemi makes no warranty, representation, or guarantee regarding the information contained herein or the suitability of its products and services for any particular purpose, nor does Microsemi assume any liability whatsoever arising out of the application or use of any product or circuit. The products sold hereunder and any other products sold by Microsemi have been subject to limited testing and should not be used in conjunction with mission-critical equipment or applications. Any performance specifications are believed to be reliable but are not verified, and Buyer must conduct and complete all performance and other testing of the products, alone and together with, or installed in, any end-products. Buyer shall not rely on any data and performance specifications or parameters provided by Microsemi. It is the Buyer's responsibility to independently determine suitability of any products and to test and verify the same. The information provided by Microsemi hereunder is provided “as is, where is” and with all faults, and the entire risk associated with such information is entirely with the Buyer. Microsemi does not grant, explicitly or implicitly, to any party any patent rights, licenses, or any other IP rights, whether with regard to such information itself or anything described by such information. Information provided in this document is proprietary to Microsemi, and Microsemi reserves the right to make any changes to the information in this document or to any products and services at any time without notice. 50200472-6/03.16