Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Su pe rs ed ed Demo Guide September 2014 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Revision History Revision Change 17 September 2014 Date 3 Fourth Release 7 April 2014 2 Third Release 09 December 2013 1 Second Release 09 October 2013 0 First Release Confidentiality Status Su pe rs ed ed This is a non-confidential document. Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 About this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Microsemi Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS . . . . 5 ed ed Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Webserver and TFTP Server Applications on SmartFusion2 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Design Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Demo Design Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Demo Design Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Setting Up the Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Board Setup Snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Running the Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Running Webserver Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Running TFTP Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 rs Appendix 1: Board Setup for Running the Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Appendix 2: Jumper Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Appendix 3: Running the Design in Static IP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Appendix 4: Running the SoftConsole Project in Debug Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 30 31 35 pe A List of Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 B Product Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Su Customer Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Contacting the Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 37 37 37 37 Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 My Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Outside the U.S. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 ITAR Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Revision 3 3 Preface About this document 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. Intended Audience • FPGA designers • Embedded designers • System-level designers References ed ed The following designers using the SmartFusion2 devices: The following references are used in this document: • lwIP TCP/IP stack: – www.sics.se/~adam/lwip/ – http://download.savannah.gnu.org/releases/lwip/ FreeRTOS stack: www.freeRTOS.org rs • Microsemi Publications SmartFusion2 Microcontroller Subsystem User Guide • SmartFusion2 SoC FPGA High Speed Serial Interfaces User Guide • Libero SoC User Guide • SmartFusion2 Advanced Development Kit User Guide pe • Su Refer to the following web page for a complete and up-to-date listing of SmartFusion2 device documentation: www.microsemi.com/soc/products/smartfusion2/docs.aspx. R ev is i on 3 4 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Introduction This demo design explains the TSEMAC features of the SmartFusion2 device and implements the Webserver, TFTP server application on SmartFusion2 Advanced Development Kit. This demo describes: 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. ed ed • 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 rs • Refer to the SmartFusion2 Microcontroller Subsystem User Guide for more information on the TSEMAC interface for SmartFusion2 devices. pe Webserver and TFTP Server Applications on SmartFusion2 Devices The Webserver and TFTP server demo designs consist of the following layers: Application Layer • Transport Layer • Firmware Layer Su • R ev is i on 3 5 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Figure 1 shows the block diagram of the Webserver and TFTP server applications on the SmartFusion2 device. Application Layer (HTTP, TFTP) Transport Layer (lwIP TCP/IP Stack) FreeRTOS ed ed Firmware Layer SmartFusion2 Advanced Development Kit (HW) Figure 1 • Block Diagram of Webserver and TFTP Server Applications on SmartFusion2 Device Application Layer The Webserver and TFTP server applications are implemented on the SmartFusion2 Advanced Development Kit board. rs 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. pe 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 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. Transport Layer (lwIP TCP/IP Stack) Su 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, refer to 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/ 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. Refer to 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: 6 • Ethernet MAC • MMUART • GPIO • SPI • RTC R ev is i on 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Design Requirements Table 1 • Design Requirements Design Requirements Description Hardware Requirements Rev B or later SmartFusion2 Advanced Development Kit • 12 V adapter • FlashPro5 • USB A to Mini-B cable - Host PC or Laptop Windows 64-bit Operating System Software Requirements ed ed RJ45 cable Libero® System-on-Chip (SoC) for viewing the design files v11.4 FlashPro Programming Software v11.4 SoftConsole v3.4SP1 Host PC Drivers USB to UART drivers • HyperTerminal • TeraTerm • PuTTY Browser - rs One of the following serial terminal emulation programs: Mozilla Firefox or Internet Explorer pe Demo Design Introduction The demo design files are available for download from the following path in the Microsemi® website: www.microsemi.com/soc/download/rsc/?f=sf2_webserver_tftp_tcp_liberov11p4_dg_df Su The demo design files include: • Libero SoC hardware project with SoftConsole firmware project • Sample files • Programming files • readme.txt file R ev is i on 3 7 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Figure 2 shows the top-level structure of the design files. For further details, refer to the Readme.txt file. GRZQORDGBIROGHU! 6)B:HEVHUYHUB7IWSB7&3B'HPRB') /LEHUR 3URJUDPPLQJ)LOHV ed ed VDPSOHBILOHV 5HDGPHW[W Figure 2 • Demo Design Files Top Level Structure Demo Design Features The demo has the following options: • Webserver – RTC and Ethernet Interface data display – Blinking LEDs – HyperTerminal Display – SmartFusion2 Google Search – SmartFusion2 Gadgets rs • TFTP server Transfers files from host PC to SmartFusion2 Advanced Development Kit pe – 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, refer to the SmartFusion2 Microcontroller Subsystem User Guide. The demo design comprises of: Libero SoC Hardware Project • SoftConsole Firmware Project Su • 8 R ev is i on 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Libero SoC Hardware Project Su pe rs ed ed Figure 3 shows the Libero SoC hardware design implementation for this demo design. Figure 3 • Libero Top-Level Design R ev is i on 3 9 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Libero hardware project uses the following SmartFusion2 MSS resources and IPs: 1. TSEMAC TBI interface 2. MMUART_0 for RS-232 communications on the Advanced Development Kit. 3. SPI_0: To access external Flash memory at25df641 4. COREAHBLSRAM: For TFTP application stack. 5. General purpose input and output (GPIO): Interfaces the light emitting diodes (LEDs) 6. High speed serial interface (SERDESIF) SERDES_IF IP, configured for SERDESIF_3 EPCS lane3 as shown in Figure 4 on page 10. Su pe rs ed ed For more information on high speed serial interfaces, refer to the SmartFusion2 SoC FPGA High Speed Serial Interfaces User Guide. Figure 4 • 10 High Speed Serial Interface Configurator Window R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Package Pin Assignments Package pin assignments for LED’s 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 D26 LED_2 F26 LED_3 A27 LED_4 C26 LED_5 C28 LED_6 B27 ed ed LED_1 LED_7 C27 LED_8 E26 Table 3 shows the port names and directions for the package pins. Table 3 • PHY Interface Signals to Package Pins Assignments Port Name PHY_MDC PHY_MDIO PHY_RST Direction Package Pin Output F3 Input K7 Output F2 rs SoftConsole Firmware Project Invoke the SoftConsole project using Standalone Softconsole IDE. Refer to the Libero SoC User Guide for more information. 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) pe • • Su Figure 1 on page 6 shows the block diagram of the Webserver and TFTP server applications on SmartFusion2 device used in this demo design. R ev is i on 3 11 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Su pe rs ed ed Figure 5 shows SoftConsole software directory structure of the demo design. Figure 5 • 12 SoftConsole Project Explorer Window R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 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_MSS_CM3_app and TFTP_Server_app 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 refer to "Appendix 4: Running the SoftConsole Project in Debug Mode" on page 35. ed ed 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. Su pe rs 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 R ev is i on 3 13 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS 4. Install the USB driver if the USB drivers are not detected automatically. 5. 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 6. Connect the jumpers on the SmartFusion2 Advanced Development Kit board as shown in Table 4. For information on jumper locations, refer to "Appendix 2: Jumper Locations" on page 30. Caution: Before making the jumper connections, switch off the power supply switch, SW7. Table 4 • SmartFusion2 FPGA Advanced Development Kit Jumper Settings 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. Make sure these jumpers are set accordingly. J124,J121,J32 1 J118,J119 1 ed ed Jumper 2 JTAG programming via FTDI 2 Programming SPI Flash 7. Connect the power supply to the J42 connector in the SmartFusion2 Advanced Development Kit. 8. 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. rs Board Setup Snapshot Snapshots of the SmartFusion2 Advanced Development Kit board with all the setup made is given in "Appendix 1: Board Setup for Running the Demo" on page 29. pe Running the Demo Design 1. Download the demo design from: www.microsemi.com/soc/download/rsc/?f=sf2_webserver_tftp_tcp_liberov11p4_dg_df. 2. Switch ON the SW7 power supply switch. 3. Start any serial terminal emulation program such as: HyperTerminal Su – – PuTTY – Tera Term 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, refer to the Configuring Serial Terminal Emulation Programs Tutorial. 14 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Running Webserver Demo 1. Launch the FlashPro software. 2. Click New Project. FlashPro New Project Su Figure 7 • pe rs ed ed 3. In the New Project window, type the project name. 4. Click Browse and navigate to the location where the project is required to be saved. 5. Select Single device as the Programming mode. 6. Click OK to save the project. 7. Click Configure Device. R ev is i on 3 15 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS FlashPro Project Configured Su Figure 8 • pe rs ed ed 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\Webse rver_TCP_top.stp. The required programming file is selected and is ready to be programmed in the device. 16 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Figure 9 • pe rs ed ed 9. Click PROGRAM to start programming the device. Wait until a message is displayed indicating that the program has passed. FlashPro Program Passed Su 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 3: Running the Design in Static IP Mode" on page 31 10. Power cycle the SmartFusion2 Advanced Development board. R ev is i on 3 17 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Figure 10 • HyperTerminal with IP Address ed ed A welcome message with the IP address is displayed in the HyperTerminal window as shown in Figure 10. Su pe rs 11. The IP address displayed on the HyperTerminal should 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 the Webserver 18 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 ed ed 12. Click RTC and Ethernet Interface data display on the main menu of Webserver demo. Figure 12 • Selecting RTC and Ethernet Interface Data Display Su pe rs Figure 13 shows a webpage with RTC values and Ethernet MAC properties. Figure 13 • Webserver RTC and Ethernet Interface Data Display 13. Click Home to go back to the main menu. R ev is i on 3 19 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Figure 14 • Selecting Blinking LEDs ed ed 14. Click Blinking LED’s on the main menu. Figure 15 shows a running LED pattern on the board. The webpage gives an option to enter the values to blink the LED’s manually. 15. 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. Su pe rs Note: The SmartFusion2 Advanced Development Kit has Active Low LEDs. Figure 15 • Blinking LEDs 16. Click Home to go back to the main menu. 20 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 ed ed 17. Click HyperTerminal Display on the main menu. Figure 16 • Selecting HyperTerminal Display pe rs Figure 17 shows a webpage that gives an option to enter a string value. Figure 17 • Webserver HyperTerminal Display Su The entered string is displayed on HyperTerminal as shown in Figure 18. Figure 18 • String Display on HyperTerminal 18. Click Home to go back to the main menu. R ev is i on 3 21 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS ed ed 19. 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 pe rs Figure 20 shows a webpage with Google search option. Figure 20 • Webserver SmartFusion2 Google Search Su 20. Click Home to go back to the main menu. 22 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 ed ed 21. Click on SmartFusion2 Gadgets on the main menu. Figure 21 • Selecting SmartFusion2 Gadgets Su pe rs Note: Internet connection is required with proper access rights to get to the SmartFusion2 Gadgets page. Figure 22 shows the Gadgets page displaying the US Zip code look-up. Figure 22 • Webserver SmartFusion2 Gadgets 22. Click Home to go back to the main menu. R ev is i on 3 23 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Running TFTP Demo pe rs ed ed 1. To enable the TFTP client in 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 23. Su Figure 23 • Enabling TFTP Client in Host PC 24 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 rs ed ed 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 24. Figure 24 • Windows Firewall Settings pe 3. Launch the FlashPro software and program the device with <download_folder>\SF2_Webserver_Tftp_TCP_Demo_DF\ProgrammingFiles\Tftp_Server\Webs erver_TCP_top_tftp.stp. Wait until a message indicating that the program passed is displayed. Refer to Step 1. to Step 9. of "Running Webserver Demo" section on page 15. Note: To run the design in static IP mode, follow the steps mentioned in the "Appendix 3: Running the Design in Static IP Mode" on page 31. Su 4. Power cycle the SmartFusion2 Advanced Development Kit board. R ev is i on 3 25 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS ed ed HyperTerminal program displays the welcome message and option to clear the SPI Flash contents as shown in Figure 25. Figure 25 • HyperTerminal with Welcome Message Su pe rs 5. Type y to erase the SPI Flash memory contents, as shown in Figure 26. Figure 26 • HyperTerminal with IP Address - Erasing SPI Flash Memory 6. Type any key other than y to skip SPI Flash erasing, as shown in Figure 27 on page 27. 26 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Figure 27 • HyperTerminal with IP Address ed ed The HyperTerminal program displays the dynamic IP address also, as shown in Figure 26 on page 26 or Figure 27. rs 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. 8. Type the following tftp command to transfer the file to the tftp server (SmartFusion2 Device) as shown in Figure 28. Su pe tftp -i < ip address> PUT <file name> Figure 28 • Command Prompt On successful file transfer from host PC to SmartFusion2 SPI-Flash, the command prompt window shows the transfer successful message as shown in Figure 29. Figure 29 • Successful Transfer Message R ev is i on 3 27 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS ed ed HyperTerminal shows the available files in SPI flash as shown in Figure 30. Figure 30 • HyperTerminal with Available SPI Flash Files 9. Repeat Step 7. and Step 8. if another file is required to be transferred to the SmartFusion2 SPIFlash from host PC. Su pe rs 10. After running the demo, close the HyperTerminal. 28 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Appendix 1: Board Setup for Running the Demo rs ed ed Figure 31 shows the board setup for running the demo on the SmartFusion2 Advanced Development Kit Board. Su pe Figure 31 • SmartFusion2 Advanced Development Kit Setup R ev is i on 3 29 J33 P1 5 C R1 R136 C 323 1 R298 DS26 U SB_ 5V D13 R327 U 16 L 3 U 49 C 605 J23 U 36 J19 J21 R163 D14 J16 R288 V DDI O R133 R131 U 28 R177 TP15 GND J22 C 701 C 700 R130 R125 GND R112 R111 HSDAC N HSDAC P C 313 R98 R97 C 303 C 623 U 11 R134 U 9 TP27 R138 C 606 U 12 U 10 GND U 17 TP1 SPK_ L R328 R326 C 325 TP2 SPK_ R 6 6 C 351 R113 R114 1 C R4 5 C R3 R164 R167 R168 R169 R170 R166 R165 R171 R329 R172 C 670 R173 C 164 C R2 R141 R143 R137 R139 TP23 1P8V C 667 L4 C 324 U 162 R178 J20 TP24 DS27 C 595 R243 U 19 X1 C 358 U 18 C 357 R140 R142 R325 R174 R175 R176 R99 R100 1P0V _ PHY C 330 R372 U 60 C 703 C 704 C 705 C 702 L6 TP26 GND TDI V C C I O _ L PC _ V ADJ TP28 TDO TC K TM S 1 TRSTN J15 Y2 C 282 N C 214 U 62 R331 K R5484 R5483 R333 R334 C 1579 D10 R46 U8 Y6 R290 R291 PL L 6 D15 R199 R198 R197 R196 R194 R193 R192 R294 R396 C 666 C 668 TP14 C 316 R127 R126 C 315 R79 C 283 C 292 C 331 C 255 R50 C 674 C 673 B1 C 699 R289 R373 R374 C 1566 R160 U 37 1.5V 1.8V 2.5V 1.2V C 672 R81 C 624R76 R286 R74 R72 R73 R71 R105 3P3V C 302 R92 R218 C 293 R91 C 295 R94 R93 C 297 R95 R96 C 314 R121 R120 R115 J18 C 308 R110 M DC R109 C 307 R108 R106 C 306 R10 7 TP29 K V C C I O _ HPC _ V ADJ 3.3V 2.5V 1.8V 1.5V 1.2V R332 J353 R351 R352 R355 R356 L5 C 100 R42 R59 R60 3P3V C O N1 C 89 C 90 C 374 A1 R808 PL L _ S0 C 102 S1_ PL L _ L 23 C 146 2P5V C 148 R64 PL L _ S1 3P3V C 209 S0_ PL L _ L 23 S0_ PL L _ L 01 2P5V C 103 R41 C 294 C 296 N C 305 R104 C 304 R40 R216 S2_ PL L _ L 01 TP31 2P5V GND R63 C 181 TP33 R58 C 144 S2_ PL L _ L 23 C 183 J4 U6 PL L FDDR 3P3V A1 PL L 2 R217 U2 PL L 0 A1 U1 U3 R375 C 359 C 361 Y4 C 360 PL L 5 S3_ PL L _ L 23 C 362 A1 SERDES3_ RXN_ 1 SERDES3_ TXP_ 1 3P3V R70 U5 U4 3P3V C 517 U 32 GND DS7 E26 H 1 L U7 L G23 H H R47 R48 Y12 R369 J10 L L H H SW 5 C 692 R1216 L L 5 4 3 2 1 R343 8 7 6 R1217 5P0V GND 1P5V _ REG L D8 Y11 R272 C 608 D7 A B SW 3 B SW 2 A C 638 U 31 R304 B A GND SW 4 B1 A1 GND B1 B1 A1 A1 L H SDA 1 L H J32 5P0V R301 R281 B A 6 5 4 O N SW 7 SC L 1 0 R155 TP7 V DD_ REG U 34 1 R330 C 596 JTAG_ SEL R161 1 TP20 GND 19 20 U 26 3 J60 3P3V TP4 19 J38 9 U 24 10 20 J116 SW T ON A1 SW 1 B1 R260 C 593 U 23 R292 FP4_ HEADER J37 2 C 691 L R162 TP17 R300 R280 1.2 V C U RRENT SENSE GND R278 PRB J29 PRA J28 3 2 H TP3 V DD_ REG_ C S U 25 R255 J125 J121 J124 L H 2 H1 V DD 1P5V O P75V 1P8V DS17 V C C I O _ L PC _ V ADJ V C C I O _ HPC _ V ADJ TP11 U 58 1P0V _ PHY 2P5V _ L DO C 28 C 26 A27 F26 D26 DS6 DS5 DS4 DS3 DS2 DS1 DS0 C 630 U 35 R366 J119 TP21 H R150 U 13 R363 J118 R361 C 328 PL L M DDR J13 R54 R55 H J9 J8 J11 C 113 C 129 SERDES_ 3_ REFC L K0_ N TP10 TP22 0P75V _ REG PL L 1 R213 C 562 R209 C 463 R1211 C 422 C 518 C 599 PL L 4 Y20 J6 J5 SERDES_ 3_ REFC L K0_ P J12 J54 GND TP32 D9 1 J42 1 R267 C1 GND J351 12V DS16 TP16 U 27 C 40 TDO 12V /5A TP12 2 12V TDI J350 C 628 3P3V _ L DO TP30 3P3V _ L DO DS28 ed ed R69 2P5V SERDES3_ RXP_ 1 J7 SERDES3_ TXN_ 1 rs J30 w w w .microsemi.com M 2S150- ADV - DEV - KI T Rev - B DV P- 101- 000408- 001 pe A1 R353 K1 R313 RM T J352 K40 R977 R973 R974 R270 R978 R975 R976 3P3V R1518 C 1575 C 1574 C 1573 C 1572 R293 J14 R156 J354 R840 R841 R842 S1_ PL L _ L 01 R78 R75 C 626 C 625 C 671 R303 J17 B11 C 530 C 471 C 98 C 382 PL L 7 M DI O A40 3P3V R191 R190 R189 R188 R184 R183 R182 R181 R179 C 554 C 484 TC 21 TC 20 TC 19 TC 18 TC 16 TC 17 C 257 C 246 PL L _ S3 C 153 C 156 SW 6 RST B B32 H B1 PL L 3 F 25 G 25 J 23 J 22 G 27 H27 F23 R318 R362 TRST_ L TM S TDO TDI GND TC K R257 R986 R985 R984 R1519 R295 C 926 R983 R210 C 119 C 211 C 210 C 213 C 212 C 136 C 135 C 138 C 137 C 140 C 139 C 142 C 141 C 173 C 172 C 175 C 174 C 177 C 176 C 179 C 178 C 216 C 215 C 92 C 91 C 94 C 93 C 96 C 95 C 220 Y3 R1212 R1208 R1210 R1207 R266 R1214 R1215 R1209 A1 C 371 R211 R158 3P3V _ V PP C 109 C 150 C 236 C 235 C 199 C 159 C 116 C 465 C 460 C 455 R1213 C 468 C 519 C 467 C 645 C 646 C 644 C 641 C 642 C 648 R311 R309 C 647 C 610 L ED9 RST C 592 R310 R253 3P3V _ L DO C 161 C 233 C 197 C 118 C 163 C 643 R378 R159 C 476 R149 R314 R316 TP9 J36 RV I _ HEADER L B27 R224 C 636 C 637 R220 C 27 R222 R307 C 604 C 600 R364 C 332 R279 C 528 C 526 C 394 C 521 DS11 P1_ L ED3 DS12 P1_ L ED2 DS13 P1_ L ED1 DS14 P1_ L ED0 DS8 P0_ L ED3 DS9 P0_ L ED2 DS10 P0_ L ED0 R283 R282 FTDI R116 R117 R118 R119 R103 R101 R102 C 378 R839 TP35 C 697 C 696 R306 R305 R308 C 640 Figure 32 • SmartFusion2 Advanced Development Kit Silkscreen Top View R277 C 698 U 59 3P3V R ev i s i o n 3 R276 J123 TRAC E_ ETM _ HEADER A1 TC K J34 GND 30 TM S A DS29 R354 Su TRST_ L H1 H40 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS Appendix 2: Jumper Locations Figure 32 shows the jumper locations in the SmartFusion2 Advanced Development Kit Board. Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Note: • Jumpers highlighted in red are set by default. • Jumpers highlighted in green must be set manually. • The location of the jumpers in Figure 32 are searchable. Appendix 3: Running the Design in Static IP Mode Su pe rs ed ed 1. To run the Webserver design in Static IP mode, right-click the Webserver_TCP_MSS_CM3_app project and select Properties as shown in Figure 33. Figure 33 • Project Explorer Window of SoftConsole Project R ev is i on 3 31 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS rs ed ed 2. Remove the symbol NET_USE_DHCP in Tool Settings of the Properties for Webserver_TCP_MSS_CM3_app window, as shown in Figure 34. Figure 34 • Webserver_TCP_MSS_CM3_app Properties Window Su pe Note: To run the TFTP server design in static IP mode remove the symbol NET_USE_DHCP in the Properties window of TFTP_Server_app, as described in Step 1. and Step 2. 32 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 pe rs ed ed 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 35 shows Host PC TCP/IP settings. Su Figure 35 • Host PC TCP/IP Settings R ev is i on 3 33 Running the Webserver and TFTP Server on the SmartFusion2 Device Using IwIP and FreeRTOS rs ed ed Figure 36 shows Static IP address settings. pe Figure 36 • Static IP Address Settings Su Once these settings are made, compile the design, load the design into memory, and run the design using the SoftConsole. 34 R ev i s i o n 3 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 Appendix 4: Running the SoftConsole Project in Debug Mode 1. Select Debug Configurations from Run menu of the SoftConsole. The Debug Configurations dialog box is displayed. ed ed 2. To debug TFTP_Server_app project, select TFTP_Server_app Debug as shown in Figure 37. rs Figure 37 • Debug Configurations for TFTP_Server_app Su pe 3. To debug Webserver_TCP_MSS_CM3_app project, select Webserver_TCP_MSS_CM3_app Debug as shown in Figure 38. Figure 38 • Debug Configurations for Webserver_TCP_MSS_CM3_app 4. After selecting the target click Debug. R ev is i on 3 35 A – List of Changes The following table lists critical changes that were made in each revision of the chapter in the demo guide. Date Changes Page Updated the document for Libero v11.4 software release details (SAR 60795). NA Updated the document for SmartFusion2 Advanced Development Kit Board details (SAR 60795). NA Revision 2 (March 2014) Updated the document to include TFTP server (SAR 55038). NA Revision 1 (December 2013) Updated the document for Libero v11.2 software release (SAR 53219). NA Revision 0 (October 2013) Initial Release NA Su pe rs ed ed Revision 3 (September 2014) Revision 3 36 B – 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. Customer Service ed ed 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 Customer Technical Support Center rs 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. Technical Support pe Visit the Customer Support website (www.microsemi.com/soc/support/search/default.aspx) for more information and support. Many answers available on the searchable web resource include diagrams, illustrations, and links to other resources on the website. Website Su You can browse a variety of technical and non-technical information on the SoC home page, at www.microsemi.com/soc. 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. 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]. Revision 3 37 Running the Webserver and TFTP Server on SmartFusion2 Devices Using lwIP and FreeRTOS - Libero SoC v11.4 My Cases Microsemi SoC Products Group customers may submit and track technical cases online by going to My Cases. 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. Sales office listings can be found at www.microsemi.com/soc/company/contact/default.aspx. ITAR Technical Support Su pe rs ed ed 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 3 38 ed ed rs pe Su 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] Microsemi Corporation (Nasdaq: MSCC) offers a comprehensive portfolio of semiconductor and system solutions for communications, defense and 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; security technologies and scalable anti-tamper products; Power-over-Ethernet ICs and midspans; as well as custom design capabilities and services. Microsemi is headquartered in Aliso Viejo, Calif. and has approximately 3,400 employees globally. Learn more at www.microsemi.com. © 2014 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. 50200472-3/09-14