当前位置:文档之家› SF2_Cortex_M3_Tutorial

SF2_Cortex_M3_Tutorial

SF2_Cortex_M3_Tutorial
SF2_Cortex_M3_Tutorial

SmartFusion2 ARM Cortex-M3 Lab Guide

Microsemi SoC Products Group, San Jose, CA 95134

? 2013 Microsemi Corporation. All rights reserved.

Printed in the United States of America

Release: April 2013

Microsemi makes no warranties with respect to this documentation and disclaims any implied warranties of merchantability or fitness for a particular purpose. Information in this document is subject to change without notice. Microsemi assumes no responsibility for any errors that may appear in this document.

This document contains confidential proprietary information that is not to be disclosed to any unauthorized person without prior written consent of Microsemi Corporation.

Trademarks

Microsemi, Microsemi Fusion, IGLOO, Libero, ProASIC, SmartFusion, SmartFusion2 and the associated logos are trademarks or registered trademarks of Microsemi Corporation. All other trademarks and service marks are the property of their respective owners.

Introduction (4)

Components of SmartFusion2 Device Used (4)

Tutorial Requirements (5)

Extracting the source files (5)

Step 1 – Download Firmware Drivers (6)

Step 2 – Creating a Libero SoC Project and configuring the SmartFusion2 MSS (7)

Launching Libero SoC (7)

Opening SmartFusion2_Simple_MSS_MSS_0 in SmartDesign (10)

Step 3 – Importing a Physical Constraint file (25)

Step 4 – Synthesis and Layout (27)

Step 5 – Programming (32)

Step 6 – Running the GPIO Application (35)

Checking Project Settings and performing a build (38)

Debugging with SoftConsole (39)

Running the GPIO_interrupt Application (42)

Step 7 - Running the polled_uart application (46)

Configuring a terminal emulator program (47)

Launching the debugger and running the application (49)

Answers to Questions (50)

List of Figures (51)

This tutorial demonstrates how to implement a basic SmartFusion2 microcontroller subsystem (MSS) configuration that includes the GPIO block and MMUART_0 using the SmartFusion2 MSS configurator.

The SmartFusion2 GPIO[8] will be configured as an input and GPIO[1:0] will be configured as outputs. The outputs will drive LEDs on the SmartFusion2 Starter kit; GPIO[8] will be connected to one of the switches on the Starter kit board.

After completing this tutorial you will be familiar with the following:

?Creating a Libero SoC project

?Configuring the SmartFusion2 MSS and generating the design

? Generating sample firmware projects from the Firmware catalog

?Synthesizing the SmartFusion2 design with Synplify Pro AE

?Importing a PDC constraint file to pin assignments and running layout on the design

?Generating a programming file and programming the SmartFusion2 device on the Starter Kit board

?Using SoftConsole to download Cortex-M3 applications to the SmartFusion2 Starter Kit board and debug the applications

Figure 1 - SmartFusion2 Block Diagram

Components of SmartFusion2 Device Used

This tutorial uses the SmartFusion2 Cortex-M3, the GPIO block and MMUART_0.

Tutorial Requirements

Software Requirements

?Microsemi Libero SoC v11.0

?ModelSim 10.1c

?Synplify Pro ME G-2012.09MSP1

?FlashPro v11.0

?SoftConsole v3.4

?HyperTerminal or similar software, normally under Start > Programs > Accessories > Communications > HyperTerminal.

Note: HyperTerminal is no longer standard on newer windows installations. For alternatives to HyperTerminal, see https://www.doczj.com/doc/3a13744892.html,/windows-7/alternatives-to-hyperterminal-in-windows-7/

?USB Drivers for the FT232R USB to UART IC:

https://www.doczj.com/doc/3a13744892.html,/documents/CDM_2.08.24_WHQL_Certified.zip

SmartFusion2 MSS Component versions

The table below lists the version of the SmartFusion2 MSS which must be used.

Hardware Requirements

This tutorial requires the following hardware for verifying the design:

?SmartFusion2 Starter Kit

?FlashPro4 Programmer

? 2 USB 2.0 A to mini-B cables

Extracting the source files

Extract SF2_Cortex-M3_tutorial.zip to extract the required lab files to the C:\Actelprj folder on the HDD of your PC. Confirm that a folder named SF2_Cortex-M3_tutorial containing a sub-folder named Source_files was extracted.

Step 1 – Download Firmware Drivers

In order to use the Firmware drivers and sample projects for SmartFusion2 it is necessary to download them from the online Repositories into the IP vault on your machine.

1.Open the Microsemi SoC Firmware catalog (Start > Programs > Microsemi Libero SoC v11.0 > Firmware Catalog

v11.0 > Firmware Catalog.

2.Look for the message New cores are available for download at the bottom of the Firmware Catalog.

Figure 2 - New cores message in the Firmware catalog

3.Click on Download them now to download all the most recent drivers for peripherals including Sample code and

CMSIS compliant HAL etc. The resulting window should look like the figure below.

Figure 3 – Firmware Catalog fully Populated

4.Close the Firmware Catalog (File > Exit).

Step 2 – Creating a Libero SoC Project and configuring the SmartFusion2 MSS

In this step you will create a Libero SoC v11.0_Beta project and configure the SmartFusion2 MSS.

Launching Libero SoC

1.Click Start > Programs > Microsemi Libero SoC v11.0 > Libero SoC v11.0, or click the shortcut on your desktop. The

Libero SoC Project Manager will open.

Figure 4 - Libero SoC v11.0 Project Manager

2.Create a new project by selecting New on the Start Page tab (circled in the figure above), or by clicking Project >

New Project from the Libero SoC menu. The New Project dialog box will open as shown in the next figure.

Figure 5 - Libero SoC v11.0 New Project dialog box

3.Click the Edit Tool Profiles button to open the Tool Profiles dialog box (circled in the figure above). Verify that the

following tool profiles exist:

?Software IDE: SoftConsole v3.4 contained in \SoftConsole\Eclipse\exlipse.exe ?Synthesis: Synplify Pro ME G-2012.09MSP1 contained in

\ Synopsys\synplify_G201209MSP1\binsynplify_pro.exe ?Simulation: ModelSim AE v10.1c contained in

< Libero_v11.0_installation>\Model\win32acoem\modelsim.exe

?Programming: FlashPro v11.0 contained in

\designer\bin\flashpro.exe

4.Click OK to close the Tool Profiles dialog box.

5.Enter the information shown below in the New Project dialog box:

?Project Name: SmartFusion2_Simple_MSS

?Project Location: C:/Actelprj/SF2_Cortex-M3_tutorial

?Preferred HDL type: Select either VHDL or Verilog based on your HDL preferences

?Family: SmartFusion2

?Die: M2S050T_ES

?Package: 896 FBGA

?Speed: STD

?Core Voltage(V): 1.2

?Ramp Rate: 100ms Minimum

?Operating conditions: COM

?Use Design Tool: checked

?Core: click on SmartFusion2 Microcontroller Subsystem (MSS) 1.0.100 to use the MSS configurator

6.If the System Builder or SmartFusion2 Microcontroller subsystem text is in Italics the core is not in your IP vault.

Right click on the name of the core and select Download Core.

Figure 6 - Libero SoC New Project parameters

7.Click OK to close the New project dialog box.

Opening SmartFusion2_Simple_MSS_MSS_0 in SmartDesign

8.The SmartDesign canvas will open with the SmartFusion2_Simple_MSS_ MSS_0 component visible.

Figure 7 – SmartFusion2 MSS in SmartDesign canvas

9.Double-click SmartFusion2_Simple_MSS_MSS_0 to open the SmartFusion2 MSS configurator. The MSS configurator

will appear as shown in the figure below.

Figure 8 - SmartFusion2 MSS configurator

MSS peripherals that can be disabled have a small wrench symbol and check box in the lower right corner. To disable a peripheral, select the peripheral, right-click, and select Disable, or click on the checkbox. The peripheral turns grey to indicate a peripheral has been disabled. Disabled peripherals can be enabled by repeating the procedure.

10.Disable all of the peripherals that have a checkbox except MMUART_0. Enable the GPIO peripheral.

Tip: click View > Maximize Work Area or the Maximize/Restore Work Area button () on the toolbar to expand the working area while using the SmartFusion2 MSS configurator to configure the MSS peripherals.

Next configure the GPIO block. For this design we will configure GPIO[1:0] as outputs and GPIO[8] as an input.

GPIO[1:0] will be connected to LEDs on the SmartFusion2 starter kit; GPIO[8] will be connected to a switch on the SmartFusion2 starter kit, the GPIOs are brought out to the fabric to match the connections on the SmartFusion2 starter kit board.

11.Configure the MSS GPIO block by double-clicking the GPIO in the MSS configurator. Configure the GPIOs as shown

below.

?Set/Reset Definition: accept default settings

?Configure GPIO[1:0] and GPIO_[8] per the table below:

Figure 9 - SmartFusion2 GPIO Configuration 12.Click OK to close the GPIO configurator.

13.Double-click the MSS_CCC box in the SmartFusion2 MSS configurator. Enter the following in the CCC configurator:

?CLK_BASE: 100 MHz

?Monitor FPGA Fabric PLL Lock: checked

?M3_CLK: 100 MHz

?APB_0_CLK: M3_CLK / 4 (25 MHz)

? APB_1_CLK: M3_CLK / 4 (25 MHz)

The APB bus clock rate of 25 MHz was selected to match the rates used in the sample firmware projects that will be generated later.

Figure 10 - SmartFusion2 MSS CCC configurator

14.Click OK to close the CCC configurator.

15.After configuring the GPIO block the MSS configurator should appear as shown in the figure below.

Figure 11 - SmartFusion2 MSS configurator after configuring GPIOs and Reset

16.Save the SmartFusion2_Simple_MSS_MSS component (File > Save SmartFusion2_Simple_MSS_MSS).

17.Close the SmartFusion2 MSS configurator (File > Close SmartFusion2_Simple_MSS_MSS).

18.If necessary, restore the work area (View > Restore Work Area).

19.Select the SmartFusion2_Simple_MSS tab. The SmartFusion2 component (SmartFusion2_Simple_MSS_MSS_0) will

be visible in the SmartDesign canvas. The warning symbol () indicates that the SmartFusion2 component has changed. Right click and select Update Instance(s) with Latest Component. The SmartDesign canvas will resemble the figure below.

Figure 12 - SmartDesign canvas with SmartFusion2 MSS component

Next you will add the SmartFusion2 Chip Oscillator and fabric CCC components to the SmartDesign canvas and connect them SmartFusion2 MSS component.

20.Expand the Clock & Management category in the Libero SoC IP Catalog.

Figure 13 - Libero SoC IP Catalog

21.Drag an instance of Chip Oscillators v1.0.100 onto the SmartDesign canvas. If the component appears shadowed in

the Vault, right-click the name and select Download.

22.Drag an instance of Clock Conditioning Circuitry (CCC) v2.0.100 onto the SmartDesign canvas. The canvas will appear

as shown in the figure below.

Figure 14 - SmartDesign canvas after adding OSC and CCC components

23.Double-click the OSC_0 component in the SmartDesign canvas to open the SmartFusion2 Chip Oscillators

configurator.

24.For this design we will use the On-chip 25/50 MHz RC Oscillator. Configure the Oscillator as follows:

?On Chip 25/50 MHz RC Oscillator: checked

?Drives Fabric (CCCs): checked

?Drives Fabric Logic: un-checked

Figure 15 - On-chip RC oscillator configuration

25.Click OK to close the Chip Oscillators Configurator.

26.Double-click the FCCC_0 component in the SmartDesign canvas to open the SmartFusion2 Fabric CCC configurator.

27.Select the Basic tab in the FAB CCC configurator. Enter the following then click OK:

?Reference clock: Select 25/50 MHz Oscillator from the pull-down menu

?PLL Analog Supply voltage: 3.3V

? GL0: checked; Frequency = 100 MHz

Figure 16 - selecting the FAB CCC reference clock

The PLL Analog Supply voltage can be either 2.5V or 3.3V. The voltage setting in the configurator must match the PLL Analog Supply voltage on the board to ensure the PLL works correctly. The PLL Analog Supply voltage is tied to 3.3V on the SmartFusion2 Starter kit, so the setting must be changed in the FAB CCC configurator above.

28.Click OK to close the FAB CCC configurator. The SmartDesign canvas will appear as shown in the figure below.

Figure 17 - SmartDesign canvas after configuring the On Chip Oscillators

https://www.doczj.com/doc/3a13744892.html,e the SmartDesign auto connect feature to connect the OSC_0 and CCC_0 blocks by right-clicking in the canvas

and selecting Auto Connect.

Figure 18 - Auto Connecting the Chip Oscillators and Fabric CCC

Next you will make connections using the QuickConnect feature in SmartDesign.

30.Click SmartDesign > QuickConnect or right click in the SmartDesign canvas and select QuickConnect. The

QuickConnect dialog box will open.

Figure 19 - SmartDesign QuickConnect dialog box

31.Connect the FCCC_0:GL0 port to the SmartFusion2_Simple_MSS_MSS_0:MCCC_CLK_BASE port by clicking on

CCC_0:GL0 in the left-hand side of the dialog box, clicking MCCC_CLK_BASE under

SmartFusion2_Simple_MSS_MSS_0 in the right-hand side of the dialog box, then right-clicking and selecting Connect. The color of the pins will change to green to indicate they are connected.

Figure 20 - Using QuickConnect to connect the CCC output to the SmartFusion2 MSS CLK_BASE port

32.Repeat the previous step to connect the FCCC_0:LOCK port to the

SmartFusion2_Simple_MSS_MSS_0:MCC_CLK_BASE_PLL_LOCK port.

33.Promote the SmartFusion2_Simple_MSS_MSS_0:GPIO_0_M2F pin to the top level by clicking in the Connection box

next to the pin name in the QuickConnect dialog box, then right-clicking and selecting Promote to Top Level.

Figure 21 - Using QuickConnect to promote GPIO_0_M2F to the top level

34.Repeat the previous step to promote the following SmartFusion2_Simple_MSS_MSS_0:GPIO_0 ports to the top

level:

?GPIO_1_M2F

?GPIO_8_F2M

35.After promoting the pins to the top level, the connected pins will be highlighted green and displayed in the right-

hand side of the QuickConnect dialog box as shown in the figure below.

Figure 22 - QuickConnect dialog box after making connections and promoting pins to the top level

36.Click Close to close the QuickConnect dialog box.

37.The canvas will appear as shown in the figure below. If necessary, right click in the canvas and select AutoArrange

Instances or Route All Nets to improve the appearance of the canvas.

Figure 23 - SmartDesign canvas after connecting the RC oscillator to the SmartFusion2 MSS

38.Save the design (File > Save SmartFusion2_Simple_MSS).

39.Open the Libero SoC project settings (Project > Project Settings).

40.Select Device I/O Settings in the Project Settings dialog box. Select LVCMOS 3.3V from the pull-down list in the

Default I/O Technology field.

相关主题
文本预览
相关文档 最新文档