sf2 webserver demo

39
DG0472 Demo Guide Running Webserver and TFTP Server on SmartFusion2 Devices Using IwIP and FreeRTOS - Libero SoC v11.7 SP2

Upload: others

Post on 16-Apr-2022

25 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: sf2 webserver demo

DG0472Demo Guide

Running Webserver and TFTP Server onSmartFusion2 Devices Using IwIP and FreeRTOS -

Libero SoC v11.7 SP2

Page 2: sf2 webserver demo

50200472. 7.0 11/16

Microsemi Corporate HeadquartersOne Enterprise, Aliso Viejo,CA 92656 USAWithin the USA: +1 (800) 713-4113 Outside the USA: +1 (949) 380-6100Fax: +1 (949) 215-4996Email: [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.

About Microsemi

Microsemi Corporation (Nasdaq: MSCC) offers a comprehensive portfolio of semiconductor and system solutions for aerospace & defense, communications, data center 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, California, and has approximately 4,800 employees globally. Learn more at www.microsemi.com.

Page 3: sf2 webserver demo

DG0472 Demo Guide Revision 7.0 i

Contents

1 Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Revision 7.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Revision 6.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.3 Revision 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.4 Revision 4.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.5 Revision 3.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.6 Revision 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.7 Revision 1.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.8 Revision 0.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Running Webserver and TFTP Server on SmartFusion2 Device . . . . . . . . . . . . . . . 22.1 Webserver and TFTP Server Demo Design Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.1.1 Application Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.2 Transport Layer (lwIP TCP/IP Stack) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.3 RTOS and Firmware Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 Design Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3 Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.3.1 Demo Design Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.3.2 Demo Design Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.4 Setting Up the Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.5 Running the Demo Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Appendix: Board Setup for Running the Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4 Appendix: Jumper Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

5 Appendix: Running the Design in Static IP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . 25

6 Appendix: Running the SoftConsole Project in Debug Mode . . . . . . . . . . . . . . . . . 28

7 Appendix: Running the Design from DDR Memory . . . . . . . . . . . . . . . . . . . . . . . . . 307.1 Changes to Libero SoC Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

7.2 Changes to SoftConsole Project for Debug Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Page 4: sf2 webserver demo

DG0472 Demo Guide Revision 7.0 ii

Figures

Figure 1 Webserver and TFTP Server Applications on a SmartFusion2 FPGA . . . . . . . . . . . . . . . . . . . . . . . 2Figure 2 Demo Design Files Top-Level Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Figure 3 Libero SoC Top-Level Hardware Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Figure 4 High-Speed Serial Interface Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Figure 5 Demo Design Directory Structure in SoftConsole Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Figure 6 Demo Design Driver Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Figure 7 Device Manager Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Figure 8 FlashPro New Project Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Figure 9 FlashPro Project Configuration Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Figure 10 FlashPro PROGRAM PASSED Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Figure 11 HyperTerminal with IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Figure 12 Webserver Demo Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Figure 13 Selecting RTC and Ethernet Interface Data Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Figure 14 Webserver RTC and Ethernet Interface Data Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Figure 15 Selecting Blinking LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Figure 16 Entering Values for LEDs to Blink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Figure 17 Selecting HyperTerminal Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Figure 18 Webserver HyperTerminal Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Figure 19 String Display on HyperTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Figure 20 Selecting SmartFusion2 Google Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Figure 21 Webserver SmartFusion2 Google Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Figure 22 Enabling TFTP Client in Host PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Figure 23 Windows Firewall Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Figure 24 HyperTerminal Welcome Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Figure 25 Erasing SPI Flash Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Figure 26 HyperTerminal with Dynamic IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Figure 27 Command Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Figure 28 Successful Transfer Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Figure 29 HyperTerminal with Available SPI Flash Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Figure 30 SmartFusion2 Advanced Development Board Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Figure 31 SmartFusion2 Advanced Development Kit Silkscreen Top View . . . . . . . . . . . . . . . . . . . . . . . . . . 24Figure 32 SoftConsole Project Explorer Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Figure 33 Webserver Properties Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26Figure 34 Host PC TCP/IP Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26Figure 35 Static IP Address Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27Figure 36 Debug Configuration for TFTP_Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Figure 37 Debug Configuration for Webserver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Figure 38 System Builder Device Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Figure 39 System Builder Memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Figure 40 Selecting Webserver Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32Figure 41 Setting the Script File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Figure 42 Selecting Debug Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Figure 43 Debug Configurations Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Page 5: sf2 webserver demo

DG0472 Demo Guide Revision 7.0 iii

Tables

Table 1 Design Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Table 2 LED to Package Pin Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Table 3 PHY Interface Signal to Package Pin Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Table 4 SmartFusion2 Advanced Development Kit Jumper Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Page 6: sf2 webserver demo

Revision History

DG0472 Demo Guide Revision 7.0 1

1 Revision History

The revision history describes the changes that were implemented in the document. The changes are listed by revision, starting with the most current publication.

1.1 Revision 7.0The following is a summary of the changes in revision 7.0 of this document.

• Libero SoC, FlashPro, and SoftConsole design requirements were updated. For more information, see Design Requirements, page 4.

• Throughout the document, the names of SoftConsole projects used in the demo design (and the associated figures) were updated.

1.2 Revision 6.0The document was updated for Libero v11.7 software release details (SAR 77020).

1.3 Revision 5.0The document was updated for Libero v11.6 software release (SAR 53219).

1.4 Revision 4.0The document was updated for Libero v11.5 software release (SAR 53219).

1.5 Revision 3.0The following is a summary of the changes in revision 3.0 of this document.

• The document was updated for Libero v11.4 software release details (SAR 60795).• The document was updated for SmartFusion2 Advanced Development Board details (SAR 60795).

1.6 Revision 2.0The document was updated to include TFTP server (SAR 55038).

1.7 Revision 1.0The document was updated for Libero v11.2 software release (SAR 53219).

1.8 Revision 0.0Revision 0.0 was the first publication of this document.

Page 7: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 2

2 Running Webserver and TFTP Server on SmartFusion2 Device

The demo design associated with this document shows the tri-speed Ethernet medium access controller (TSEMAC) features of the SmartFusion2® device. The design has a Webserver and a trivial file transfer protocol (TFTP) server implemented on a SmartFusion2 Advanced Development Board. For more information about this board, see UG0557: SmartFusion2 SoC FPGA Advanced Development Kit User Guide.

The design demonstrates the following.

• Use of SmartFusion2 Ethernet MAC connected to a serial gigabit media independent interface (SGMII) PHY.

• Integration of SmartFusion2 MAC driver with lwIP TCP/IP stack and FreeRTOS operating system.• Implementation of Webserver on the SmartFusion2 Advanced Development Board.• Implementation of TFTP server on the SmartFusion2 Advanced Development Board.• Procedure to run Webserver and TFTP server designs on the SmartFusion2 Advanced

Development Board.

The microcontroller subsystem (MSS) of the SmartFusion2 device has an instance of the TSEMAC peripheral, which can be configured between the host PC and the Ethernet network at 10/100/1000 Mbps data transfer rates (line speeds).

For more information about the TSEMAC interface for SmartFusion2 devices, see UG0331: SmartFusion2 Microcontroller Subsystem User Guide.

2.1 Webserver and TFTP Server Demo Design LayersThe Webserver and TFTP server demo designs have the following layers.

• Application layer• Transport layer (lwIP TCP/IP stack)• RTOS and firmware layer

The following figure is a block diagram of the three layers in the Webserver and TFTP server applications on the SmartFusion2 device.

Figure 1 • Webserver and TFTP Server Applications on a SmartFusion2 FPGA

Transport Layer(lwIP TCP/IP Stack) FreeRTOS

Firmware Layer

SmartFusion2 AdvancedDevelopment Kit (HW)

Application Layer(HTTP, TFTP)

Page 8: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 3

2.1.1 Application LayerThe Webserver handles the HTTP request from the client (host PC) browser and transfers the static pages to the client in response to its request. When the IP address (for example, http://10.60.3.25) is typed in the address bar of the browser, an HTTP request is sent to the port associated with the Webserver. The Webserver then interprets the request and responds to the client with the requested page or resource.

The TFTP client (the host PC) transfers files to the SmartFusion2 device (the TFTP server) using the TFTP PUT command. Transferred files are stored in the SmartFusion2 Advanced Development Board external flash memory, which is connected to the SmartFusion2 SPI_0 interface. The file allocation table (FAT) file system on the SPI flash is used to display the files available in SPI flash memory.

2.1.2 Transport Layer (lwIP TCP/IP Stack)The lwIP TCP/IP stack, developed by Adam Dunkels at the Swedish Institute of Computer Science (SICS), is suitable for embedded systems because of its low system resource usage. The IwIP stack can be used with or without an operating system. It consists of actual implementations of IP, ICMP, UDP, and TCP protocols, as well as the support functions such as buffer and memory management.

For more information about IwIP design and implementation, see www.sics.se/~adam/lwip/doc/lwip.pdf.

lwIP is available (under a BSD license) in C source-code format for download at http://download.savannah.gnu.org/releases/lwip/.

2.1.3 RTOS and Firmware LayerFreeRTOS is an open-source, real-time operating system kernel. In this demo, FreeRTOS is used to prioritize and schedule tasks. For more information about FreeRTOS, including the latest source code, see http://www.freertos.org.

The firmware provides software drivers to configure and control the following MSS components.

• Ethernet MAC• MMUART • GPIO• SPI• RTC

Page 9: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 4

2.2 Design RequirementsThe following table lists the hardware and software requirements for running this demo design.

2.3 Demo DesignThe demo design files are available for download at http://soc.microsemi.com/download/rsc/?f=m2s_dg0472_liberov11p7sp2_df.

The demo design files include:

• A Libero SoC hardware project with the corresponding SoftConsole firmware project• Sample files to be transferred to the SmartFusion2 device using the TFTP server• Programming files• A Readme.txt file

The following figure shows the top-level structure of the demo design files. For more information, see the Readme.txt file.

Figure 2 • Demo Design Files Top-Level Structure

Table 1 • Design Requirements

Design Requirements Description

Hardware

SmartFusion2 Advanced Development Kit with:- 12 V adapter- FlashPro5- USB A to mini-B cable

Rev A or later

Ethernet cable RJ45

Host PC or laptop Windows 64-bit operating system

Software

Libero® System-on-Chip (SoC) for viewing the design files

v11.7 SP2

FlashPro programming software v11.7 SP2

SoftConsole v4.0

Host PC drivers USB to UART drivers

MSS Ethernet MAC drivers v3.1.100

A serial terminal emulation program HyperTerminal, TeraTerm, or PuTTY

Browser Mozilla Firefox or Internet Explorer

Page 10: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 5

2.3.1 Demo Design Features• Webserver: Displays options for the following:

• RTC and Ethernet interface data display• LED blinking• HyperTerminal display• SmartFusion2 Google Search

• TFTP server: Transfers files from the host PC to the SmartFusion2 Advanced Development Board

2.3.2 Demo Design DescriptionThe demo design is implemented using an SGMII PHY interface, by configuring the TSEMAC for ten-bit interface (TBI) operation. For more information about the TSEMAC TBI interface, see UG0331: SmartFusion2 Microcontroller Subsystem User Guide.

This section provides detailed information about the Libero SoC hardware project and SoftConsole firmware project associated with the demo design.

2.3.2.1 Libero SoC Hardware ProjectThe following figure shows the Libero SoC top-level hardware design implementation for the demo design.

Figure 3 • Libero SoC Top-Level Hardware Design

Page 11: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 6

The Libero SoC hardware project uses the following SmartFusion2 MSS resources and IP.

• TSEMAC TBI interface for supporting Ethernet functionality on the SmartFusion2 device• MMUART_0 interface for RS-232 communications on the SmartFusion2 Advanced Development Kit• SPI_0 interface for accessing external flash memory• General purpose input and output (GPIO) for connecting to the LEDs on the board• Dedicated input pad 0 as the clock source• SERDES_IF IP high-speed serial interface configured for SerDesIF_3 EPCS Lane 3 (as shown in

the following figure)

Figure 4 • High-Speed Serial Interface Configuration

For more information about high-speed serial interfaces, see UG0447: IGLOO2 and SmartFusion2 High Speed Serial Interfaces User Guide.

Page 12: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 7

2.3.2.1.1 Package Pin AssignmentEach LED and PHY interface signal on the SmartFusion2 board has a package pin assigned to it.The following table lists the LED port names and corresponding package pins.

The following table lists the PHY interface signals and corresponding package pins

Table 2 • LED to Package Pin Assignment

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 • PHY Interface Signal to Package Pin Assignment

Port Name Direction Package Pin

PHY_MDC Output F3

PHY_MDIO Input K7

PHY_RST Output F2

Page 13: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 8

2.3.2.2 SoftConsole Firmware ProjectThe following stacks available in the SoftConsole Project Explorer are used in this demo design.

• lwIP TCP/IP stack v1.4.1 • FreeRTOS

The following figure shows the directory structure of the demo design in SoftConsole.

Figure 5 • Demo Design Directory Structure in SoftConsole Project

The SoftConsole workspace consists of the following projects.

• TFTP_Server: contains the TFTP server application (which uses LWIP, FreeRTOS, and FatFs) and all the firmware and hardware abstraction layers that correspond to the hardware design.

• Webserver: contains the Webserver application (which uses LWIP and FreeRTOS) and all the firmware and hardware abstraction layers that correspond to the hardware design.

Page 14: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 9

The following figure shows the driver versions used for the demo.

Figure 6 • Demo Design Driver Versions

2.4 Setting Up the Demo DesignThe following steps describe how to setup the demo for SmartFusion2 Advanced Development Board.

1. Connect the host PC to the J33 connector using a USB A to mini-B cable.The COM ports are automatically detected and displayed in the Device Manager window.

Note: If the COM ports are not detected automatically, install the FTDI D2XX driver for serial terminal communication through the FTDI mini-USB cable. The driver, along with the installation guide, is available at www.microsemi.com/soc/documents/CDM_2.08.24_WHQL_Certified.zip.

2. Right-click each of the four detected COM ports, and click Properties to find the port with the location on USB FP5 Serial Converter C, as shown in the following figure.

Figure 7 • Device Manager Window

3. Make a note of the COM port number for use during serial terminal configuration. For more information, see Running the Demo Design, page 10.

Page 15: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 10

4. Connect the jumpers on the SmartFusion2 Advanced Development Board as specified in the following table. Caution: Switch OFF the power supply switch, SW7, before connecting the jumpers.

For information about jumper locations, see Appendix: Jumper Locations, page 24.

5. Connect the power supply to the J42 connector in the SmartFusion2 Advanced Development Kit.6. Depending on the IP mode you want to use for the design, connect one of the following to the J21

connector of the SmartFusion2 Advanced Development Kit Board using an RJ45 cable. • For static IP mode, connect the host PC.• For dynamic IP mode, connect any one of the open network ports.

Note: By default, programming files are provided for dynamic IP mode. To run the design in static IP mode, see Appendix: Running the Design in Static IP Mode, page 25.

2.4.0.1 Board Setup For snapshots of the SmartFusion2 Advanced Development Board setup for the demo design, see Appendix: Board Setup for Running the Demo, page 23.

2.5 Running the Demo DesignIn order to run the demo design, perform the following steps:

1. Download the demo design files from http://soc.microsemi.com/download/rsc/?f=m2s_dg0472_liberov11p7sp2_df.

2. Switch ON the power supply switch (SW7).3. Start a serial terminal emulation program such as HyperTerminal, PuTTY, or TeraTerm.

Note: For this demo, HyperTerminal is used.

4. Configure the program’s serial terminal settings as follows.• Baud Rate: 115200• Eight data bits• One stop bit• No parity• No flow controlFor more information about configuring serial terminal emulation programs, see Configuring Serial Terminal Emulation Programs Tutorial.

Table 4 • SmartFusion2 Advanced Development Kit Jumper Settings

Jumper Pin From Pin To Comments

J116, J353, J354, J54 1 2 Default jumper settings for the SmartFusion2 Advanced Development Board

J123 2 3

J124, J121, J32 1 2 JTAG programming through FTDI

J118, J119 1 2 Programming through SPI flash

Page 16: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 11

2.5.0.1 Running Webserver DemoThe following steps describe how to run the Webserver demo.

1. Launch the FlashPro software.2. Click New Project.3. In the New Project window, enter the project name.

Figure 8 • FlashPro New Project Window

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.

Page 17: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 12

8. Click Browse, 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\Programming-Files\webserver\

Figure 9 • FlashPro Project Configuration Window

The selected file is ready to be programmed to the device.

Page 18: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 13

9. Click PROGRAM to start programming the device. Wait until a PROGRAM PASSED message is displayed, as shown in the following figure.

Figure 10 • FlashPro PROGRAM PASSED Message

The HyperTerminal window displays a welcome message with an IP address, as shown in the fol-lowing figure.

Figure 11 • HyperTerminal with IP Address

Page 19: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 14

10. Open a web browser, and enter the IP address displayed on the HyperTerminal window in the address bar of the browser. The SmartFusion2 Webserver demo main menu appears, as shown in the following figure.

Figure 12 • Webserver Demo Main Menu

11. Click RTC and Ethernet Interface data display.

Figure 13 • Selecting RTC and Ethernet Interface Data Display

The following web page appears, displaying RTC values and Ethernet MAC properties.

Figure 14 • Webserver RTC and Ethernet Interface Data Display

Page 20: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 15

12. Click Home to go back to the main menu.13. Click Blinking LEDs on the main menu.

Figure 15 • Selecting Blinking LEDs

The LEDs on the board start blinking, and a web page appears, with an option to enter a value to toggle LEDs manually.

Figure 16 • Entering Values for LEDs to Blink

14. Enter any number between 1-255 to toggle the LEDs manually. Because the SmartFusion2 Advanced Development Kit has active-low LEDs, if 1 is entered, LED1 goes OFF; if 255 is entered, all the eight LEDs go OFF.

15. Click Home to go back to the main menu.16. Click HyperTerminal Display on the main menu.

Page 21: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 16

Figure 17 • Selecting HyperTerminal Display

A web page appears with an option to enter a string value to be displayed in HyperTerminal.

Figure 18 • Webserver HyperTerminal Display

17. Enter the desired string value, and click Submit.The following message appears, indicating that the string was successfully submitted.

Figure 19 • String Display on HyperTerminal

18. Click Home to go back to the main menu.19. Click SmartFusion2 Google Search on the main menu.

Page 22: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 17

Figure 20 • Selecting SmartFusion2 Google Search

Note: An Internet connection is required to access the SmartFusion2 Google Search page.

A web page appears, with the SmartFusion2 Google Search option.

Figure 21 • Webserver SmartFusion2 Google Search

20. Click Home to go back to the main menu.

Page 23: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 18

2.5.0.2 Running the TFTP DemoThe following steps describe how to run the TFTP demo.

1. To enable the TFTP client in the host PC, navigate to Control Panel > Programs and Features. 2. Click Turn Windows Features On or Off, select TFTP Client in the Windows Features dialog box,

and click OK, as shown in the following figure.

Figure 22 • Enabling TFTP Client in Host PC

3. Navigate to Control Panel > Windows Firewall, and click Turn Windows Firewall On or Off.

Page 24: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 19

4. Select Turn off Windows Firewall under Domain network location settings, and click OK, as shown in the following figure.

Figure 23 • Windows Firewall Settings

5. Launch the FlashPro software, and program the device with the Webserver_TCP_top_tftp.stp file located at <download_folder>\SF2_Webserver_Tftp_TCP_Demo_DF\ProgrammingFiles\Tftp_Server\. Wait until the PROGRM PASSED message is displayed. (See steps 1 to 9 of Running Webserver Demo, page 11.)

Page 25: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 20

The HyperTerminal window displays a welcome message with an option to clear SPI flash contents, as shown in the following figure.

Figure 24 • HyperTerminal Welcome Message

6. Type y to erase SPI flash memory, as shown in the following figure.

Figure 25 • Erasing SPI Flash Memory

Page 26: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 21

7. Type any key other than y to avoid erasing SPI flash.The HyperTerminal program displays a dynamic IP address, as shown in the following figure.

Figure 26 • HyperTerminal with Dynamic IP Address

8. Open the command prompt on 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

9. Select a file that needs to be transferred, and type the following TFTP command to transfer the file to the TFTP server (the SmartFusion2 device):tftp -i < ip address> PUT <file name>

Figure 27 • Command Prompt

Upon successful file transfer from the host PC to the SmartFusion2 SPI flash, the command prompt displays a message indicating that the transfer was successful.

Figure 28 • Successful Transfer Message

Page 27: sf2 webserver demo

Running Webserver and TFTP Server on SmartFusion2 Device

DG0472 Demo Guide Revision 7.0 22

HyperTerminal displays the available files in SPI flash, as shown in the following figure.

Figure 29 • HyperTerminal with Available SPI Flash Files

10. Repeat steps 9 and 10 for any additional files that need to be transferred from the host PC to the SmartFusion2 SPI flash.

11. After running the demo, close the HyperTerminal window.Note: To run the SoftConsole project in debug mode, see Appendix: Running the SoftConsole Project in Debug

Mode, page 28. To run the design from DDR memory, see Appendix: Running the Design from DDR Memory, page 30.

Page 28: sf2 webserver demo

Appendix: Board Setup for Running the Demo

DG0472 Demo Guide Revision 7.0 23

3 Appendix: Board Setup for Running the Demo

The following figure shows the board setup for running the demo on the SmartFusion2 Advanced Development Board.

Figure 30 • SmartFusion2 Advanced Development Board Setup

Page 29: sf2 webserver demo

Appendix: Jumper Locations

DG0472 Demo Guide Revision 7.0 24

4 Appendix: Jumper Locations

The following figure shows the jumper locations on the SmartFusion2 Advanced Development Board.

Figure 31 • SmartFusion2 Advanced Development Kit Silkscreen Top View

Note: Jumpers highlighted in red in the figure are set by default; jumpers highlighted in green must be set manually.

DS3

R318

R362

R369

SW5

R277

TP35

C638

SW4

DS2

DS1

Y11

C692

R121

6

C698

R280

C697 C696

R278

R279

J29

J28

C332

J125

C610DS0

R364

R338

R336

R337

R335

R346

R344

R345

R343

R121

7

TP17

U59

R276

R283

R255

U25

J121

DS20

DS21

DS19

DS18

DS25

DS23

DS24

DS22

R281

R300

J123

R282

TP3

C600

C604

J124

R151

R152

DS17

U58

R155

U34

R330R162

J32

R161

R147

H1

R148

R292

TP11

U26

TP7

C596

J36

C691

R313

R301

TP20

SW1

J116

DS29

U23

R260

J38

J37

C593

SW7

R354

TP4

R253

U24

U27

D9

J42

TP12

R267 DS16

J351

TP16

J60

P1

J33

MH2

C323

R136CR1

R298 C164

CR2

DS26

MH1

SW6

R142

R140

J23

C605

J21

J19

L3

CR3

CR4

DS27

R138

U12

R396

C606

U36

C351

U16

U19

C595

X1

R243 LED9

C316 U9

R126R127

U10

R141

C325 R1

37R143

TP2

R325

R326R328

R164

D13

R167

R168

R169

C358

R163

C357

U18

C315

TP27

U11

R131

R125R133

R130

C324R1

39

TP1

R112

R111

R113

R114

C313

R97

C303

R100

C668

C666

C667

R327

R165

R170

R171

U17

R199

R194

R197

R198

R373

R374

R288

C699

R294

R289

J16

C306

C307

C308C314

C295

C297

R98

C293

C302R99

TP14

TP23

R329

L4

C670

R176

R172

R173

R174

R175

R182

R184

R181

R189R190R191R1

92R193

J34

C704

C705

U60

C700

C702

C701

J15

C282

R106R107

R108R109R110R115R120R121

R93R95R96

R104R105

R91R92

R94

C623 J20

J22TP15

TP24

R46

U28

D14

R177R178

R985

TP26

C703

L6

TP28

C674

C292

C283

Y2

C255 R116

R79

DS11

DS12

J14

R50 C2

14

R5484

C156

6

U162

R983

R257

R984

R842

R840

R841

J354

C672

R156

C673

U37

R372C331

R78

R81R76

C330

U8

R101

R117

R118

R119

DS13

DS14

DS8

R331

U62

R333C1579

D10

R5483

C157

4C1

575

C157

3Y6

R1519

J352

R839

R355R356

R351R352

R332

J353

L5

R293

C626

C624

R303 C246

C257 J17

R75

R102

R103 TP36

DS10

DS9

TP76

D15

R291

R290

C157

2

R334

R270

R160

R295

TP29

R286

C671C625

R73R74

J18

C382

R218TP75

C305C304

C296C294

R40

C378

R216

C98

TP33 TP57TP69

TP31

R975

R976R978

R973

R974

R977

C926

CON1

R71R72

TP78

TP51

R41TP38

R58

TP42

R63

TP48

C521

C394

C528

C526

C530

C471

C554

C484

C90C89

C209C103

C100

TP73

C144

TP54

C181

TP71

R808

TP77 C374

C210

C211

R42C102

R59C146TP44

R60C148

TP46

U6

TP70

C136

C135

C212

C213

TP40

TP39

R64

TP66

R217TP64

C142

C140

C139

C138

C137

TP50

C183

TP53

U1

C173

C172

C141

U2

R210TP60

C174

C175

C176

C177

J30

C179

C178

C216

C215

U3

C94

C93

C91

C92

R266

R121

2R1

210R1

208

R120

7

R375

C359

Y3

C360

C361

Y4

C362C220

C95

C96

U5

R120

9R1

215 Y20

R121

4

R1211

R378

TP74

C371

TP56

R69

J4

J7

U4

C599

C463C422

R211

C153

C156

TP72

R70 C109

C150

TP58

TP49TP67

TP10

C467

TP41TP62

C468

R213R121

3

C518

C562

C233

C161

C119

C236

C235

C199

J6

J5

DS28

C647TP22

C460

C455

C519

R209

TP68

C328

C197

C163

C118

C465

C159

C116

R353

R310

U32

C646

C645

C644

J118

R363

R361

U13

R150

C476

C517

R54R55

J54

TP30

C628

C643

C648

R309

R311

C642

C641

J119

J13

C129

C113

J12

TP32

R308

R307

D7D8

TP21

TP9

R366

R149

U35

R220

R272C608

C630

DS7

R314

R316

R158

R159

C640

R305R3

06C6

36

R222

R224

DS6

DS5

Y12

R47R48

U7

J10

J8

J9

J11

J350

U31

R304

C637

SW3

SW2

DS4

1

1

2

1

2

B

A

6

5

4

19

20

19

20

9

10

3

21

32

C1

C40

H1

H40

13

25

47

68

1

2

B

A

B

A

B

A

A1 A1 A1

A1

A1

K1

A1

A40

K40

B32

A1

B1

R986

A1

R1518

R166

R183

R188

R196

A1

R179

5

1

5

1

B1

A1

U49

B

A

R134

C592

Page 30: sf2 webserver demo

Appendix: Running the Design in Static IP Mode

DG0472 Demo Guide Revision 7.0 25

5 Appendix: Running the Design in Static IP Mode

The following steps describe how to run the design in static IP mode.

Note: This procedure provides steps to run the Webserver design. To run the TFTP server design, perform the same steps by selecting the TFTP_Server project in SoftConsole.

1. In SoftConsole Project Explorer window, right-click the Webserver project, and select Properties, as shown in the following figure.

Figure 32 • SoftConsole Project Explorer Window

Page 31: sf2 webserver demo

Appendix: Running the Design in Static IP Mode

DG0472 Demo Guide Revision 7.0 26

2. In the Tool Settings tab of the Properties for Webserver window, remove the NET_USE_DCHP symbol, and click OK, as shown in the following figure.

Figure 33 • Webserver Properties Window

3. Change the host TCP/IP settings to reflect the board’s static IP address, 169.254.1.23. The following figure shows the host PC TCP/IP settings.

Figure 34 • Host PC TCP/IP Settings

Page 32: sf2 webserver demo

Appendix: Running the Design in Static IP Mode

DG0472 Demo Guide Revision 7.0 27

The following figure shows static IP address settings.

Figure 35 • Static IP Address Settings

4. After configuring the settings, compile the design, load it into memory, and run it using SoftConsole.

Page 33: sf2 webserver demo

Appendix: Running the SoftConsole Project in Debug Mode

DG0472 Demo Guide Revision 7.0 28

6 Appendix: Running the SoftConsole Project in Debug Mode

The following steps describe how to run the SoftConsole project in debug mode.

1. In SoftConsole, select Run > Debug Configurations. The Debug Configurations dialog box is displayed.

2. Select the appropriate project:• To debug the TFTP_Server project, select TFTP_Server Debug, as shown in the following

figure.

Figure 36 • Debug Configuration for TFTP_Server

Page 34: sf2 webserver demo

Appendix: Running the SoftConsole Project in Debug Mode

DG0472 Demo Guide Revision 7.0 29

• To debug the Webserver project, select Webserver Debug, as shown in the following figure.

Figure 37 • Debug Configuration for Webserver

3. Click Debug.

Page 35: sf2 webserver demo

Appendix: Running the Design from DDR Memory

DG0472 Demo Guide Revision 7.0 30

7 Appendix: Running the Design from DDR Memory

This appendix describes the changes to be made to the Libero SoC and SoftConsole projects in order to run the demo design from DDR memory.

7.1 Changes to Libero SoC ProjectOpen the project in Libero SoC, and perform the following steps.

1. In the System Builder, enable MDDR, as shown in the following figure.

Figure 38 • System Builder Device Features

Page 36: sf2 webserver demo

Appendix: Running the Design from DDR Memory

DG0472 Demo Guide Revision 7.0 31

2. Configure the DDR3 settings as indicated in the following figure.Note: The DDR configuration file, DDR_Config.txt, is available at:

<download_folder>\SF2_Webserver_Tftp_TCP_Demo_DF\sample_files\DDR_Config\

Figure 39 • System Builder Memories

3. Generate the programming file, and program the board.

Page 37: sf2 webserver demo

Appendix: Running the Design from DDR Memory

DG0472 Demo Guide Revision 7.0 32

7.2 Changes to SoftConsole Project for Debug ModeTo run the project in debug mode, perform the following steps in SoftConsole.

1. In the Project Explorer window, right click the Webserver project, and select Properties.

Figure 40 • Selecting Webserver Properties

Page 38: sf2 webserver demo

Appendix: Running the Design from DDR Memory

DG0472 Demo Guide Revision 7.0 33

2. Set the debug-in-microsemi-smartfusion2-external-ram.ld linker script file, as shown in the following figure.

Figure 41 • Setting the Script File

3. Build the SoftConsole application, and select Run > Debug Configurations, as shown in below figure

Figure 42 • Selecting Debug Configurations

4. In the Debug Configurations window, go to the Debugger tab.

Page 39: sf2 webserver demo

Appendix: Running the Design from DDR Memory

DG0472 Demo Guide Revision 7.0 34

5. In the config options field, replace the existing value with -file board/microsemi-smartfusion2-dev-kit-ddr.cfg, as shown in the following figure.

Figure 43 • Debug Configurations Window

6. Click Debug to run the project from DDR memory in debug mode.