Академический Документы
Профессиональный Документы
Культура Документы
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
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.
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.
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 7
Working with Libero IDE and SoftConsole
8 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)
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:
10 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 11
Working with Libero IDE and SoftConsole
12 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 2 − Adding the Microcontroller Subsystem (MSS)
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 13
Working with Libero IDE and SoftConsole
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:
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.
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.
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.
18 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 3 − Creating Top Level Component
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 19
Working with Libero IDE and SoftConsole
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.
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.
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.
22 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 5 − Running Layout and Generating the FDB File
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.
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.
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 25
Working with Libero IDE and SoftConsole
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:
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 27
Working with Libero IDE and SoftConsole
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
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 29
Working with Libero IDE and SoftConsole
30 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 31
Working with Libero IDE and SoftConsole
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.
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"
/*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( );
for (;;)
{
uint8_t display_buffer[32];
uint16_t adc_result;
int32_t adc_value_mv;
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)));
}
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 35
Working with Libero IDE and SoftConsole
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
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 37
Working with Libero IDE and SoftConsole
38 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole
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:
40 Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion
Step 9 – Running Software Applications through SoftConsole
Displaying POT Level with LEDs: Libero IDE and SoftConsoleFlow Tutorial for SmartFusion 41
Working with Libero IDE and SoftConsole
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.
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.
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.
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.
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
Website
You can browse a variety of technical and non-technical information on Actel’s home page, at http://www.actel.com/.
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
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 .
50200213-2/08.10