Вы находитесь на странице: 1из 52

Displaying POT Level with LEDs

Libero IDE and SoftConsole Flow Tutorial for


SmartFusion
Actel Corporation, Mountain View, CA 94043
© 2010 Actel Corporation. All rights reserved.
Printed in the United States of America
Part Number: 50200213-2
Release: August 2010
No part of this document may be copied or reproduced in any form or by any means without prior written consent of
Actel.
Actel 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. Actel 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 Actel Corporation.

Trademarks
Actel, Actel Fusion, IGLOO, Libero, Pigeon Point, ProASIC, SmartFusion and the associated logos are trademarks or
registered trademarks of Actel Corporation. All other trademarks and service marks are the property of their respective
owners.
Table of Contents

Introduction ..................................................................................................................4
Tutorial Requirements.............................................................................................................................. 4
Objectives ................................................................................................................................................ 5

Working with Libero IDE and SoftConsole ..............................................................7


Step 1 − Creating a New Libero IDE Project ........................................................................................... 7
Step 2 − Adding the Microcontroller Subsystem (MSS) ......................................................................... 9
Step 3 − Creating Top Level Component............................................................................................... 19
Step 4 − Synthesis .................................................................................................................................. 20
Step 5 − Running Layout and Generating the FDB File ........................................................................ 21
Step 6 − Programming the SmartFusion Board Using FlashPro ............................................................ 26
Step 7 – Configuring Serial Terminal Emulation Program .................................................................... 28
Step 8 – Installing Drivers for the USB to RS232 Bridge ...................................................................... 30
Step 9 – Running Software Applications through SoftConsole ............................................................. 30
Step 10 – Debugging the Application .................................................................................................... 42

Appendix A – IP Catalog Settings ............................................................................45

Appendix B – Firmware Catalog Settings ...............................................................47

Product Support .........................................................................................................49


Customer Service ................................................................................................................................... 49
Actel Customer Technical Support Center............................................................................................. 49
Actel Technical Support......................................................................................................................... 49
Website .................................................................................................................................................. 49
Contacting the Customer Technical Support Center .............................................................................. 49

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 3
Introduction

This tutorial shows you how to use Actel tools to develop an application which can be implemented on SmartFusion™
intelligent mixed signal FPGAs. After completing this tutorial you will be familiar with the following:
1. Creating and implementing an Actel Libero® Integrated Design Environment (IDE) project using SmartFusion.
2. Using SmartDesign to configure the peripherals.
3. Configuring the analog compute engine (ACE).
4. Generating embedded flash memory configuration (EFC), FlashPro database (FDB), the programming database
(PDB) file and using FlashPro to program the SmartFusion Evaluation Kit.
5. Creating a SoftConsole project.
6. Configuring the SoftConsole compiler/linker settings.
7. Compiling the application code.
8. Creating and launching a debug session.
9. Debugging and running the code using SoftConsole.

Tutorial Requirements
Software Requirements
This tutorial requires the following software installed on your computer:
• Libero IDE v9.0 (or newer) can be downloaded from the link below:
www.actel.com/download/software/libero/default.aspx.
• SoftConsole v3.1 (or newer). SoftConsole is often installed as part of Libero IDE v9.0 installation and can also be
downloaded from the link below: www.actel.com/download/software/softconsole/default.aspx.
• FlashPro v9.0 (or newer). FlashPro is often installed as part of Libero IDE installation and can be launched from
within Libero IDE or standalone.

Target Board
SmartFusion Evaluation Kit (A2F-EVAL-KIT)

Hardware Requirements
This tutorial requires the following hardware
• SmartFusion Evaluation Kit board.
• Two USB cables (programming and communication): One for connecting the programmer to your computer and the
other to connect the UART interface on the board to computer.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 4
Objectives

Project Files
You can download the associated solution project files for this tutorial from the Actel website:
www.actel.com/download/rsc/?f=SmartFusion_LiberoSoftConsole_POTlevel_tutorial_DF.
The folder contains following files/folders:
• Libero IDE project
• SoftConsole project
• USB drivers

Objectives
This tutorial demonstrates how to configure SmartFusion analog channels and ACE that is used to monitor the voltage
across the potentiometer (POT). The UART is used to send the ADC results to a terminal program.
The hardware configuration has four flags:
• Over 1.0 V
• Over 1.5 V
• Over 2.0 V
• Over 2.5 V
The design monitors the voltage across a POT and four flags are included for the voltage monitoring. These flags are
used to drive the four LEDs on the board.

Design Steps
• Create a Libero IDE project and use the SmartFusion MSS Configurator to configure the ACE, adding a voltage
monitor with flags.
• Perform Synthesis and Layout and generate a programming file to program the SmartFusion Evaluation Kit.
• Create a software project in SoftConsole.
• Run an application to monitor the voltage across the potentiometer on the SmartFusion Evaluation Kit board.

MSS Components Used


• ARM® Cortex™-M3
• Clock conditioning circuitry (CCC)
• General purpose input/output (GPIO)
• UART_0
• Analog compute engine (ACE)

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 5
Working with Libero IDE and SoftConsole

This tutorial covers creating a Libero IDE Project, configuring the SmartFusion MSS components, performing
synthesis, generating an FDB file, programing the device, creating a software project in SoftConsole, and running the
application.

Step 1 − Creating a New Libero IDE Project


1. Launch Libero IDE v9.0.
2. Open Libero IDE and create a new project using Project > New Project. Enter the information shown below in
the Libero New Project dialog box and click Next:
• Project Name: Voltage_Monitor
• Project location: <..> (Example: C:\Actelprj\POT_LED_Libero_SoftConsole\Voltage_Monitor)
• Preferred HDL Type: Verilog or VHDL
3. Enter the following in the Family, Die, and Package dialog box and click Next:
Family: SmartFusion
Die: A2F200M3F
Package: 484 FBGA

Figure 1 · New Project Wizard – Family, Die and Package


If the tool profile for Synopsis® Synplify® AE or FlashPro do not exist, you will need to add a new profile.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 7
Working with Libero IDE and SoftConsole

4. If the profile exists, click Next. If not, add a new profile.

Figure 2 · New Project Wizard – Select Integrated Tools


5. Confirm your selections and click Finish.

Figure 3 · New Project Wizard – Summary

8 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)

Step 2 − Adding the Microcontroller Subsystem (MSS)


After creating a new project following the steps described in Step 1 − Creating a New Libero IDE Project, a window
appears, asking you to add MSS in your project.
1. Enter a design name (voltage_monitor_mss) in the Add Microcontroller Subsystem window, and click OK.

Figure 4 · Adding the MSS


Note: If the latest version of SmartFusion MSS (2.1.108) does not appear, refer to Appendix A - IP Catalog Settings to
find out how to set your repositories. If your vault does not have MSS core, then SmartDesign prompts for
downloading the core. Click Yes to download the core.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 9
Working with Libero IDE and SoftConsole

2. The MSS appears in the SmartDesign Canvas, as shown in the figure below:

Figure 5 · MSS in the SmartDesign Canvas


The MSS peripherals that are enabled are highlighted in blue and can be configured in the hardware. The disabled
peripherals are shown in gray, and those that can be configured in firmware are in shown in orange.
To disable the peripherals that are not required:
• Select the peripheral, right-click, and clear the check box for the Enabled option; or
• Clear the check box in the lower right corner of the peripheral box

Figure 6 · A – Disabling the Peripheral


You can also disable a peripheral by clearing the check box in the lower right corner of the peripheral box.

Figure 7 · B – Disabling the Peripheral


This example uses only the Clock Management, ACE, GPIO, and UART_0 peripherals.
Disable the following peripherals: MAC, Fabric Interface, SPI0, SPI1, I2C0, I2C1, UART1, and EMC.

10 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)

Figure 8 · Used MSS Peripherals


3. Double-click the Clock Management block and configure as shown below.
CLKA: On-Chip RC Oscillator
MSS clock frequency: 80 MHz
ACLK: /1 (80 MHz)
PLCK0: /1 (80 MHz)
PCLK1: /1 (80 MHz)
Defaults for all other settings

Figure 9 · MSS Clock Configurator


4. After completing the configuration, click OK.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 11
Working with Libero IDE and SoftConsole

Configuring the ACE Peripheral


1. To configure ACE, double-click the ACE peripheral block and configure as follows:
TM0 is connected to the POT on the SmartFusion Evaluation Kit board. Configure a voltage monitor to measure
the voltage across the POT and also to create flags to indicate when the voltage is greater than 1.0 V, 1.5 V, 2.0 V,
and 2.5 V. These flags are used to illuminate the LEDs on the SmartFusion Evaluation Kit board.

Figure 10 · Configure ACE


2. Select ADC Direct Input > Add (or, double-click ADC Direct Input) and enter the parameters as shown below in
the Configure ADC Direct Input dialog box:
Signal name: TM0_Voltage
Send raw results to DMA: Cleared check box
Acquisition time: 10 µs
Filtering factor: None
3. Next, add the flags as shown in the table below:
Flag Name Flag Type Threshold (V) Hysteresis (mV)
over_1p0v OVER 1 1
over_1p5v OVER 1.5 1
over_2p0v OVER 2 1
over_2p5v OVER 2.5 1
Table 1 · Flag Definitions

12 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)

Figure 11 · MSS ADC Direct Input Configuration


4. Click OK.
5. Assign the ADC Direct Input Signal to package pin number W8 in the Configure ACE Dialog Box. The
Configure ACE tab should appear as shown below:

Figure 12 · Configure ACE Tab


6. The next step in configuring the ACE is to enable the sampling sequence. This configuration dialog is launched by
clicking on the Controller tab (next to the Configure ACE tab).

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 13
Working with Libero IDE and SoftConsole

7. Select Manual as the Operating sequence entry in the Controller tab.

Figure 13 · MSS ACE Configuration to Enable Sampling Sequence


8. Click Insert operating sequence slot as shown in Figure 13.
9. Select SAMPLE.

Figure 14 · Select SAMPLE


10. The Configure SAMPLE window appears. Select TM0_voltage and click OK.

Figure 15 · Configure SAMPLE


11. Click the Insert operating sequence slot button again and select RESTART SEQUENCE.

14 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)

12. Click Calculate Actual Rate. The final Controller tab window should appear as shown below:

Figure 16 · MSS ACE Configuration: Final Controller Tab


13. Click the Flags tab in the Configure ACE window. This tab lists the flags set from PPE registers.

Figure 17 · MSS ACE Configuration: Flags Tab


14. Click the + sign to expand the Flag registers group. The PPE_FLAGSn registers contain the user-defined flags.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 15
Working with Libero IDE and SoftConsole

15. Select PPE_FLAGS0 (FLAGBANK0). Observe that PPE_FLAGS0 contains the 4 threshold flags assigned
earlier. These are the flags that were defined when the direct input voltage service was configured. The Flag
register can be read by the Cortex-M3. The flags also generate interrupts to the Cortex-M3 processor.

Figure 18 · ACE Flag Mapping - PPE Flag Registers


16. Click OK to close the ACE configuration window.

Configuring the GPIO Peripheral


Double-click the GPIO block in the MSS component, configure as shown below, and click OK.

Figure 19 · Configure MSS_GPIO_0

16 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)

This example requires GPIO_27, GPIO_26, GPIO_25, and GPIO_24 to be connected to LED_4 to LED_1 on the
Evaluation Kit board. These signals will be routed through the fabric to I/O pins H17, C19, B20, and B19,
respectively.

Generating the SmartDesign MSS


1. Select Canvas > Show Nets, to display the nets in the canvas.

Figure 20 · Show Nets


2. Your canvas appears as shown below:

Figure 21 · MSS in SmartDesign Canvas

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 17
Working with Libero IDE and SoftConsole

3. On the Firmware tab, disable the generation of the firmware for all the peripherals which are not required.
Also, make sure that you are generating the CMSIS for SoftConsole by checking the configuration settings of the
CMSIS peripheral.

Figure 22 · Firmware Tab Configuration Settings – CMSIS Peripheral


4. Check whether you are able to see the latest version of the drivers and there is no warning or error saying that
firmware is missing from the Vault. If missing, refer to the Appendix B – Firmware Catalog Settings.
5. Save your design and Generate.

Figure 23 · Save Design and Generate


6. Confirm that the design was successfully generated.
7. The log window displays a confirmation that Netlist, Firmware, and eNVM programming files have been
generated successfully.
8. Close SmartDesign using File > Exit. The voltage_monitor_mss component will be visible on the Libero IDE
Hierarchy tab.

18 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 3 − Creating Top Level Component

Step 3 − Creating Top Level Component


1. Click the SmartDesign button in the Libero IDE Project flow window. Enter the following in the New dialog box
and click OK:
Select a Type: SmartDesign Component
Name: ACE_TOP (name is case sensitive)

Figure 24 · New Dialog Box


2. The SmartDesign canvas is displayed. Select MSS component (voltage_monitor_mss) in the Libero IDE
Hierarchy tab and drag it into the canvas.

Figure 25 · Select voltage_monitor_mss

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 19
Working with Libero IDE and SoftConsole

3. Promote the M2F_GPIO [27:24] pins to the top level.

Figure 26 · SmartDesign Canvas


4. Save the design and click SmartDesign > Generate Design.
5. Confirm that the generation of design is completed without any errors and click OK.
6. In the Libero IDE hierarchy window, ensure that the correct component is set as the root. The current root is
shown in bold in the hierarchy window. To modify, right-click on the desired component and select the Set as
root option.

Figure 27 · Root Shown in the Hierarchy Window

Step 4 − Synthesis
1. Open Synplify by clicking the Synthesis button in the Libero IDE Design Flow window.
2. Clicking RUN. Synplify Pro compiles and synthesizes the design, and creates an EDIF netlist named
ACE_TOP.edn. Open the Synplify Pro log file to view errors if any are reported. The EDIF file, ACE_TOP.edn, is
displayed under the Synthesis Files on the Libero IDE Files tab.

Figure 28 · Synplify Pro

20 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 5 − Running Layout and Generating the FDB File

3. Select File > Exit. You will observe that the Synthesis tab in the Project Manager window has turned green.

Figure 29 · Synthesis Tab is Green

Step 5 − Running Layout and Generating the FDB File


1. Click the Place&Route button in the Libero IDE Project Flow window to open Designer. The Organize
Constraints for Designer window is displayed.
2. Accept the default constraint files (ACE_TOP.pdc and ACE_TOP_sdc.sdc) and click OK. Libero IDE sends the
EDIF netlist, timing constraints generated by Synplify Pro, and the pin assignments generated by SmartDesign to
Designer.

Figure 30 · Organize Constraints

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 21
Working with Libero IDE and SoftConsole

3. The Designer window is displayed. Accept the default die and package settings in the Device selection Wizard and
click Next.
4. Accept the default settings in the Device selection Wizard – Variations window and click Next.
5. Accept the default settings in the Device selection Wizard – Operating Conditions window and click Finish.
6. Click the Compile button in the Designer GUI to compile the design.

Figure 31 · Compile Button


7. Click OK in the Compile Options dialog box to accept the default compile options. The Compile button turns
green to indicate that the design compiled without any errors.

Figure 32 · Compile Options

22 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 5 − Running Layout and Generating the FDB File

Figure 33 · Green Compile Button – No Errors


8. Open the PinEditor or the I/O Attribute Editor in the MultiView Navigator by clicking the PinEditor or I/O
Attribute Editor button in the Designer GUI.
9. Make the following pin assignments:
GPO_24 to B19
GPO_25 to B20
GPO_26 to C19
GPO_27 to H17

Figure 34 · Pin Assignments

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 23
Working with Libero IDE and SoftConsole

10. Commit and check the edits using File > Commit and Check. Correct any errors that are reported in the MVN
log window.
11. Close the MultiView Navigator using File > Exit.
12. Click the Layout button in the Designer GUI to run layout on the design.
13. Accept the default layout options. When layout completes successfully, the Layout button turns green.

Figure 35 · Layout Options

Figure 36 · Layout Button


14. Click the FlashPro Data File button in the Designer GUI to generate the FPGA Array data file.

24 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 5 − Running Layout and Generating the FDB File

15. The FlashPro Data File button in the Designer GUI turns green when the file has been generated.

Figure 37 · FlashPro Data File Button


16. Close Designer using File > Exit.
17. Click Yes when prompted to save the design. The Actel database file and programming file will be visible on the
Libero IDE Files tab under Designer Files. The Project manager window should look like this:

Figure 38 · Project Manager Window

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 25
Working with Libero IDE and SoftConsole

Step 6 − Programming the SmartFusion Board Using FlashPro


1. Before proceeding with programming the device, ensure the following jumper settings are done and then connect
the board to the system through USB cables:
JP10 : Short pin 1 and 2 using a jumper.
JP7: Short pin 1 and 2 using a jumper for LCPS mode.
J6: Connect pin 1 and 2 using the jumper.
JP6: Connect pin 2 and 3 using the jumper.
J13: Connect the USB cable to the J13 connector. When the cable is connected, the FlashPro drivers might be
installed if they are not already installed.
J14: Connect second mini USB cable to power up the board.
2. Now, from the Libero IDE Project Manager window, launch programming (FlashPro).

Figure 39 · Launch FlashPro


3. Select the Configure Device button. The following window is displayed:

Figure 40 · Modify Button


4. Select the Modify button and the FPGA Array and Embedded Flash Memory options.

26 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 6 − Programming the SmartFusion Board Using FlashPro

5. Ensure that, ACE_TOP.fdb and MSS_ENVM_0.efc file paths are appearing under FPGA Array and Embedded
Flash Memory options (see the snapshot below). If not, import the ACE_TOP.fdb file by browsing to the
following folder: ..\designer\impl1\ACE_TOP.fdb.
Import the MSS_ENVM_0.efc file from the following location:
..\component\work\voltage_monitor_mss\MSS_ENVM_0.
6. Click Save PDB:

Figure 41 · Save PDB


7. Click the Program button in the FlashPro GUI to program the SmartFusion device.
Note: Do not interrupt the programming sequence; it may damage the device or the programmer. If you
encounter any problems, contact Actel Tech Support.
8. Observe that the Programmer Status is RUN PASSED.

Figure 42 · RUN PASSED Status


9. From the File menu, select Exit. Press Yes to save your project.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 27
Working with Libero IDE and SoftConsole

Step 7 – Configuring Serial Terminal Emulation Program


Prior to monitoring the voltage across POT, you must configure the Serial Terminal Emulation program installed on
your PC.
• Connect the mini USB cables between the USB connector on the SmartFusion Evaluation Kit board and the
USB port of your PC. If Windows prompts you to connect to Windows Update, select No and press Next.
• If the SFE USB to RS232 Controller drivers are automatically detected (can be verified in Device Manager), as
shown in the figure below, proceed to Step 9; otherwise follow Step 8.

Figure 43 · Device Manager


1. Select Start > All Programs > Accessories > Communications > HyperTerminal. If your computer does not
have HyperTerminal program, use any free serial terminal emulation program like PuTTY or Tera Term. Refer to
the Configuring Serial Terminal Emulation Programs tutorial for configuring the HyperTerminal, Tera Term, and
PuTTY.

Figure 44 · Name the Connection


2. Name the connection ace and click OK.
3. Select the appropriate COM port (to which USB-RS232 drivers are pointed).

28 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 7 – Configuring Serial Terminal Emulation Program

4. You can check your COM port configuration by using System Properties > Hardware > Device Manager >
expand the COM ports.
5. Enter the following parameters in the Properties window:
Bits per second: 57600
Data bits: 8
Parity: None
Stop bits: 1
Flow control: None

Figure 45 · COM Properties


6. Click OK.
7. Next time you can directly open HyperTerminal (without configuring) by using All Programs > Accessories >
Communications > HyperTerminal > ace.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 29
Working with Libero IDE and SoftConsole

Step 8 – Installing Drivers for the USB to RS232 Bridge


Note: You must have full administrative rights for your system to install the USB-RS232 drivers.
Use the following steps to install drivers for the USB to RS232 Bridge:
1. Unzip USB_Drivers.zip and browse to the USB Drivers folder.
2. Double-click (Run) PreInstaller.exe.
3. Accept the default installation location and click Install.
4. Click Continue Anyway if prompted.
5. When the installation is complete, click OK. The Ports (COM & LPT) section of the Device Manager window
lists the SFE USB to RS232 Controller.

Figure 46 · Device Manager

Step 9 – Running Software Applications through SoftConsole


Following these steps you can run an application program that monitors the voltage across the potentiometer. The
voltage is displayed on HyperTerminal and the voltage monitor flags can be seen as glowing LEDs on the SmartFusion
Evaluation Kit board.
1. Open SoftConsole by clicking Start > Programs > Actel SoftConsole v3.1 (or newer) > Actel SoftConsole IDE
or by clicking the SoftConsole v3.1 (or newer) shortcut on the desktop of your PC.
2. The SoftConsole workspace launcher is displayed. Click Browse and browse to your SoftConsole workspace
directory, and then click OK (see the figure below). In this example, SoftConsole_workspace is the workspace
directory.

Figure 47 · SoftConsole Workspace Launcher


3. SoftConsole v3.1 (or newer) opens.

30 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole

Creating a New Project


1. Create a new C project in Soft console using File > New > C Project. A window as shown below is displayed:

Figure 48 · Select Project Name


2. You can now enter the name of the project (voltage_monitor) and the project will be saved in the default location
that you specified while selecting your workspace (SoftConsole_workspace). Again, you can browse to your
specified location; but it is advisable that you keep your project in the workspace you defined.
3. Select Actel Cortex-M3 Tools and click Next.

Figure 49 · Select Configurations

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 31
Working with Libero IDE and SoftConsole

4. Ensure that the Debug and Release options are selected.


5. Click Finish. Now you need to import the firmware drivers generated by the MSS Configurator.
6. Right-click on the project (voltage_monitor) and select Import (as shown in the figure below).

Figure 50 · Import Firmware Drivers


7. Expand the General tab and select File System (as shown in figure below) and click Next.

Figure 51 · Import Resources

32 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole

8. Browse to your Libero IDE Project (Voltage_Monitor), select the firmware directory (as shown in the picture
below) and click OK.

Figure 52 · Import from Directory


9. Select drivers, CMSIS, and drivers_config folders and click Finish.
Note: The hardware abstraction layer (HAL) is used when the design contains soft cores in the fabric, which is
not the case with this design. So, there is no need to include it.

Figure 53 · Specify Folder

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 33
Working with Libero IDE and SoftConsole

10. Finally, the CMISS, drivers and drivers_config folder should appear under the project hierarchy list.
11. Create a main.c file, which should read voltage readings from the ACE through ACE drivers, display it on
HyperTerminal through UART drivers, and light the LEDs on the board by passing the values via GPIOs through
GPIO drivers.
12. For creating the main.c file, select File > New > Source File. Enter the Source file name as main.c and click
Finish. It opens main.c editor in the SoftConsole.
Sample C code is provided below:
Sample main.c Code
#include ".\drivers\mss_uart\mss_uart.h"
#include ".\drivers\mss_ace\mss_ace.h"
#include ".\drivers\mss_gpio\mss_gpio.h"
#include ".\drivers\mss_watchdog\mss_watchdog.h"

#include <stdio.h>

int main()
{
/* Disable Watchdog Timer*/
MSS_WD_disable();

#define Actel_logo \
"\n\r \
******** *** * * \n\r \
******* * * * * \n\r \
****** * * * * * * ***** * * * * * \n\r \
***** * * * * * * * \n\r \
**** ******* * * * * * * * \n\r \
*** * * * * * * \n\r \
** * * * * * * \n\r \
* * * * * * * * * * * * * \n\r"

const uint8_t greeting[] =


"\n\rWelcome to Actel's SmartFusion Voltage Monitor\n\n\r";
const uint8_t * channel_name;

/*Initialize and Configure GPIO*/


MSS_GPIO_init();
MSS_GPIO_config( MSS_GPIO_27 , MSS_GPIO_OUTPUT_MODE );
MSS_GPIO_config( MSS_GPIO_26 , MSS_GPIO_OUTPUT_MODE );
MSS_GPIO_config( MSS_GPIO_25 , MSS_GPIO_OUTPUT_MODE );
MSS_GPIO_config( MSS_GPIO_24 , MSS_GPIO_OUTPUT_MODE );

/*Initialize UART_0*/

34 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole

MSS_UART_init(
&g_mss_uart0,
MSS_UART_57600_BAUD,
MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT );

/*Initialize ACE*/
ACE_init( );

MSS_UART_polled_tx_string( &g_mss_uart0, (const uint8_t*)Actel_logo );


MSS_UART_polled_tx( &g_mss_uart0, greeting, sizeof(greeting) );

channel_name = ACE_get_channel_name( TM0_Voltage );

for (;;)
{
uint8_t display_buffer[32];
uint16_t adc_result;
int32_t adc_value_mv;

adc_result = ACE_get_ppe_sample( TM0_Voltage );


adc_value_mv = ACE_convert_to_mV( TM0_Voltage, adc_result );

if ( adc_value_mv < 0 )
{
snprintf((char*)display_buffer, sizeof(display_buffer),
"%s : -%.3fV\r\b", channel_name, ((float)(-adc_value_mv) /
(float)(1000)));
}
else
{
snprintf((char*)display_buffer, sizeof(display_buffer),
"%s : %.3fV\r\b", channel_name, ((float)(adc_value_mv) / (float)(1000)));
}

MSS_UART_polled_tx_string( &g_mss_uart0, display_buffer );

/* Checking the status of Voltage flags */


int32_t flag_status_2p5v = ACE_get_flag_status(TM0_Voltage_over_2p5v);
int32_t flag_status_2p0v = ACE_get_flag_status(TM0_Voltage_over_2p0v);
int32_t flag_status_1p5v = ACE_get_flag_status(TM0_Voltage_over_1p5v);
int32_t flag_status_1p0v = ACE_get_flag_status(TM0_Voltage_over_1p0v);

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 35
Working with Libero IDE and SoftConsole

/* Voltage flags are displayed on the LEDs through GPIO */


uint32_t gpio_output;
if ( flag_status_2p5v == FLAG_ASSERTED )
gpio_output = ~(
MSS_GPIO_24_MASK |
MSS_GPIO_25_MASK |
MSS_GPIO_26_MASK |
MSS_GPIO_27_MASK );
else
if ( flag_status_2p0v == FLAG_ASSERTED )
gpio_output = ~(
MSS_GPIO_24_MASK |
MSS_GPIO_25_MASK |
MSS_GPIO_26_MASK );
else
if ( flag_status_1p5v == FLAG_ASSERTED )
gpio_output = ~(
MSS_GPIO_24_MASK |
MSS_GPIO_25_MASK );
else
if ( flag_status_1p0v == FLAG_ASSERTED )
gpio_output = ~(
MSS_GPIO_24_MASK );
else
gpio_output = (
MSS_GPIO_24_MASK |
MSS_GPIO_25_MASK |
MSS_GPIO_26_MASK |
MSS_GPIO_27_MASK );

MSS_GPIO_set_outputs( gpio_output );
}
return 0;
}
/***************************************************************************/

36 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole

13. Right-click on the project (voltage_monitor) and select Properties.

Figure 54 · Select Properties


14. Expand the C/C++ Build tab and select settings.
15. Select Miscellaneous under GNU C Linker. Set the Linker Flags field to:
-T../CMSIS/startup_gcc/debug-in-actel-smartfusion-esram.ld
This linker script builds an executable that runs from the SmartFusion internal SRAM.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 37
Working with Libero IDE and SoftConsole

Figure 55 · Voltage Monitor Properties - Miscellaneous


16. After confirming all the settings, click Apply. Click OK to close the Project Settings dialog box.

Building the Project


1. Select the project (voltage_monitor).
2. Perform a clean build by selecting Clean from the Project menu. Accept the default settings in the Clean dialog
box and click OK.

Figure 56 · SoftConsole Clean Dialog Box


3. Confirm that there are no errors listed in the Problems View.

38 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole

Configuring Debug Target


1. Before using the on-chip debugger (OCD), the debug target must be configured.
2. Select voltage_monitor in the Soft Console Project Explorer View.
3. Select Open Debug Dialog/Debug Configurations from the Run menu. The Debug window is displayed as seen
in the figure below:

Figure 57 · SoftConsole Debug Dialog


4. Select Actel Cortex-M3 RAM Target, then right-click and select New. A debug target named voltage_monitor
Debug will be visible.
5. Confirm that the following appear on the Main tab in the Debug window:
• Name: voltage_monitor Debug
• Project: voltage_monitor
• C/C++ application: Debug\voltage_monitor

Figure 58 · Cortex-M3 Debug Target

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 39
Working with Libero IDE and SoftConsole

6. Select the Commands tab. Confirm that commands appear in the Initialize and Run command sections, as shown
in figure below:

Figure 59 · Debugger Commands


7. Click Apply and Debug.
8. Click Yes in the Confirm Perspective Switch window.

Figure 60 · Confirm Perspective Switch

40 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole

Starting the Debug Session and Running the Application


1. Your Debug Prospective should resemble the figure below:

Figure 61 · Debug Perspective


2. Run the application by clicking Run > Resume or by clicking the Run icon on the SoftConsole toolbar. The
voltage measurement along with the greeting message is displayed in the terminal program window.
3. Turn the POT on the SmartFusion Evaluation Kit Board. The voltage measurement will be displayed on
HyperTerminal and the LEDs on the SmartFusion Evaluation Kit board will illuminate when one of the voltage
monitor flags is asserted.
4. Adjust the POT and observe that the voltage measurement is continuously updated.

Figure 62 · Voltage Monitor

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 41
Working with Libero IDE and SoftConsole

Figure 63 · Voltage Measurement Continuous Update


5. Observe the state of the LEDs as the potentiometer is adjusted. Confirm that the flags work as specified in the
ACE configurator.

Step 10 – Debugging the Application


You can follow the steps below to further debug the application:
1. Suspend the software application by clicking Run > Suspend from the SoftConsole menu.
2. Select the Registers tab on the upper window pane to view the value of the Cortex-M3 internal registers.

Figure 64 · Registers Tab

42 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 10 – Debugging the Application

3. Select the Variables tab in the upper left window pane to view the value of variables in the source code.

Figure 65 · Variables Tab


4. Choose Window > Show View > Disassembly to display the assembly level instructions. The Assembly window
will open on the right side in the middle of the Debug perspective.

Figure 66 · Assembly Window


5. You can single-step through the source code by choosing Run > Step Into or Run > Step Over or by clicking the
Step Into or Step Over icons. Observe the changes in the source code window and Disassembly view.
Performing a Step Over allows for stepping over functions. The entire function is executed but there is no need to
single step through each instruction contained in the function.
6. Click the Instruction Stepping icon and then perform Step Into operations. Observe that Step Into now
executes a single line of assembly code.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 43
Working with Libero IDE and SoftConsole

7. Click the Instruction Stepping icon to exit the instruction stepping mode. Single-step through the application and
observe the instruction sequence in the source code window in the middle of the Debug perspective, and the
values of the variables and registers.
8. Resume execution of the code by choosing Run > Resume or by clicking the Resume icon.
9. You can even add breakpoints in the application for further debugging.
10. Once you are done, Terminate the debugger by selecting voltage_monitor Debug in the Debug view, then right-
clicking and selecting Terminate and Remove.

Figure 67 · Terminating the Program


11. Close the Debug perspective by selecting Close Perspective from the Window menu.
12. Close the voltage monitor project by selecting the project name in the SoftConsole Project Explorer view, right–
clicking, and selecting Close Project.
13. Close SoftConsole using File > Exit.
14. Close HyperTerminal using File > Exit. Click Yes when prompted for closing immediately.

44 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Appendix A – IP Catalog Settings

Click the IP catalog options button from the Libero IDE Project Manager Window as shown in the figure below.

Figure 68 · IP Catalog Options Button


1. Select Repositories under Vault/Repositories Settings in the Options dialog box.
2. Confirm that the following repositories are displayed (add them if needed):
www.actel-ip.com/repositories/SgCore
www.actel-ip.com/repositories/DirectCore
www.actel-ip.com/repositories/Firmware
3. Add the above mentioned paths in the address field if required, by selecting the repository and clicking Add.

Figure 69 · Vault and Repository Settings


4. Select Display under View Settings in the Options dialog box. Confirm show core version is selected.

Figure 70 · IP Catalog Display Settings

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 45
Appendix B – Firmware Catalog Settings

1. Open Firmware Catalog by clicking Start > Programs > Actel Libero IDE v9.0 (or newer) > Firmware Catalog
v9.0 (or newer).
2. Select Tools > Vault/Repositories Settings, from the Firmware Catalog window.

Figure 71 · Firmware Catalog Settings


3. Select Repositories under Vault/Repositories Settings in the Options dialog box.
4. Confirm that the following repositories are displayed (add them if needed):
• www.actel-ip.com/repositories/SgCore
• www.actel-ip.com/repositories/DirectCore
• www.actel-ip.com/repositories/Firmware
Add the above mentioned paths in the address field if required, by selecting the repository and clicking Add.
5. Click Download them now! to download the latest version of the cores from the repositories.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 47
Product Support

Actel backs its products with various support services including Customer Service, a Customer Technical Support
Center, a web site, an FTP site, electronic mail, and worldwide sales offices. This appendix contains information about
contacting Actel and using these support services.

Customer Service
Contact Customer Service for non-technical product support, such as product pricing, product upgrades, update
information, order status, and authorization.
From Northeast and North Central U.S.A., call 650.318.4480
From Southeast and Southwest U.S.A., call 650. 318.4480
From South Central U.S.A., call 650.318.4434
From Northwest U.S.A., call 650.318.4434
From Canada, call 650.318.4480
From Europe, call 650.318.4252 or +44 (0) 1276 401 500
From Japan, call 650.318.4743
From the rest of the world, call 650.318.4743
Fax, from anywhere in the world 650. 318.8044

Actel Customer Technical Support Center


Actel staffs its Customer Technical Support Center with highly skilled engineers who can help answer your hardware,
software, and design questions. The Customer Technical Support Center spends a great deal of time creating
application notes and answers to FAQs. So, before you contact us, please visit our online resources. It is very likely we
have already answered your questions.

Actel Technical Support


Visit the Actel Customer Support website (http://www.actel.com/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 Actel web site.

Website
You can browse a variety of technical and non-technical information on Actel’s home page, at http://www.actel.com/.

Contacting the Customer Technical Support Center


Highly skilled engineers staff the Technical Support Center from 7:00 A.M. to 6:00 P.M., Pacific Time, Monday through
Friday. Several ways of contacting the Center follow:

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.

Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 49
Product Support

The technical support email address is tech@actel.com.

Phone
Our Technical Support Center answers all calls. The center retrieves information, such as your name, company name,
phone number and your question, and then issues a case number. The Center then forwards the information to a queue
where the first available application engineer receives the data and returns your call. The phone hours are from 7:00
A.M. to 6:00 P.M., Pacific Time, Monday through Friday. The Technical Support numbers are:

650.318.4460
800.262.1060
Customers needing assistance outside the US time zones can either contact technical support via email
(tech@actel.com) or contact a local sales office. Sales office listings can be found at
www.actel.com/company/contact/default.aspx.

50 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Actel is the leader in low power FPGAs and mixed signal FPGAs and offers the most comprehensive
portfolio of system and power management solutions. Power Matters. Learn more at http://www.actel.com .

Actel Corporation • 2061 Stierlin Court • Mountain View, CA 94043 • USA


Phone 650.318.4200 • Fax 650.318.4600 • Customer Service: 650.318.1010 • Customer Applications Center: 800.262.1060
Actel Europe Ltd. • River Court, Meadows Business Park • Station Approach, Blackwater • Camberley Surrey GU17 9AB • United Kingdom
Phone +44 (0) 1276 609 300 • Fax +44 (0) 1276 607 540
Actel Japan • EXOS Ebisu Building 4F • 1-24-14 Ebisu Shibuya-ku • Tokyo 150 • Japan
Phone +81.03.3445.7671 • Fax +81.03.3445.7668 • http://jp.actel.com
Actel Hong Kong • Room 2107, China Resources Building • 26 Harbour Road • Wanchai • Hong Kong
Phone +852 2185 6460 • Fax +852 2185 6488 • www.actel.com.cn

50200213-2/08.10

Вам также может понравиться