0% found this document useful (0 votes)
398 views

SmartFusion SoftConsole POTlevel UART Tutorial UG

No part of this document may be copied or reproduced without prior written consent of Actel Corporation. Information in this document is subject to change without notice. This document contains confidential proprietary information that is not disclosed to any unauthorized person.

Uploaded by

fiveangles
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
398 views

SmartFusion SoftConsole POTlevel UART Tutorial UG

No part of this document may be copied or reproduced without prior written consent of Actel Corporation. Information in this document is subject to change without notice. This document contains confidential proprietary information that is not disclosed to any unauthorized person.

Uploaded by

fiveangles
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

Displaying POT Values Over UART

SoftConsole Standalone 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: 50200212-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 ..................................................................................................................5
Tutorial Requirements.............................................................................................................................. 5
Objectives ................................................................................................................................................ 6

Working with the SoftConsole ....................................................................................7


Step 1 – Launching SoftConsole .............................................................................................................. 7
Step 2 – Creating a Software Application Project .................................................................................... 7
Step 3 – Configuring External Tools (MSS and FlashPro) ...................................................................... 9
Step 4 – Configuring the Serial Terminal Emulation Program .............................................................. 26
Step 5 – Installing Drivers for the USB to RS232 Bridge ...................................................................... 27
Step 6 – Adding a New Source File (main.c) to the Project................................................................... 28
Step 7 – Running the Application .......................................................................................................... 32
Step 8 – Debugging the Application ...................................................................................................... 36

Appendix A - Vault/Repositories Settings in SmartDesign ....................................41

Appendix B - Firmware Catalog Settings ................................................................43

Product Support .........................................................................................................45


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

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 3
Introduction

This tutorial demonstrates how to develop an application that can be implemented using SmartFusion™ intelligent
mixed signal FPGAs. After completing this tutorial, you will be familiar with the following:
1. Creating and implementing a project using SoftConsole and an intelligent mixed-signal SmartFusion FPGA
2. Using SmartDesign to configure the peripherals
3. Configuring the analog compute engine (ACE)
4. Generating an embedded flash memory configuration (EFC), programming database (PDB) file and using
FlashPro to program the SmartFusion Evaluation Kit
5. Compiling the application code
6. Creating and launching a debug session

Tutorial Requirements
Software Requirements
This tutorial requires the following software installed on your computer:
• Actel Libero® Integrated Design Environment (IDE) v9.0 (or newer) that can be downloaded from the link below:
www.actel.com/download/software/libero/files.aspx.
• SoftConsole v3.2 (or newer)
SoftConsole v3.1 comes integrated with Libero IDE v9.0, but the latest version can be downloaded from the link
below:
www.actel.com/download/software/softconsole/default.aspx.http://www.actel.com/download/reg/download.aspx?p=
f=SoftConsolev31
• FlashPro v9.0 (or newer)
FlashPro is often installed as a part of Libero IDE installation and can be launched from within Libero IDE or
standalone.

Target Board
Smart Fusion 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 Universal Asynchronous Receiver/Transmitter (UART) interface on the board to computer.

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

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 5
Introduction

• USB drivers

Objectives
The objective of this tutorial is to explain how to configure the SmartFusion™ MSS peripherals using the SmartFusion
MSS configurator outside the Libero IDE flow. The steps are as follows:
• Configure the SmartFusion MSS peripherals using SmartDesign MSS
• Generate the programming file and program the SmartFusion device
• Create a simple project and run the application using the SoftConsole debugger
As a part of MSS configuration, this tutorial demonstrates how to configure SmartFusion analog channels and ACE
(used to monitor the voltage across the potentiometer).
The UART_0 is used to send the analog to digital Converter (ADC) results to a serial terminal program
(HyperTerminal).
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 potentiometer (POT) and the four flags are included for voltage monitoring.

MSS Components Used


• ARM® Cortex™-M3
• Communications matrix
• Clock conditioning circuitry (CCC)
• UART_0
• ACE

6 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Working with the SoftConsole

Step 1 – Launching SoftConsole


1. Open SoftConsole (Start > Programs > Actel SoftConsole v3.2 (or newer) > Actel SoftConsole IDE).
2. The Workspace Launcher is displayed as shown in Figure 1 below. Enter the location of your workspace (for
example: C:\Actelprj\POT_UART_SoftConsole\Only_SoftConsole) in the Workspace Launcher window and click
OK.
You can switch workspaces within SoftConsole by selecting File > Switch Workspace.

Figure 1 · Workspace Launcher

Step 2 – Creating a Software Application Project


1. Create a new C project in the Soft console using: File > New > C Project. The window shown in Figure 2
appears.

Figure 2 · New C Project

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 7
Working with the SoftConsole

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 (Only_SoftConsole). You can browse to your specified
location; however, it is advisable that you keep your project in the workspace you defined.
3. Select Actel Cortex-M3 Tools and click Next.

Figure 3 · Select Configurations


4. Make sure that the Debug and Release options are selected.
5. Click Finish.

8 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

Step 3 – Configuring External Tools (MSS and FlashPro)


In this step you will configure the SmartDesign MSS and FlashPro tools to be launched from the SoftConsole.

Configuring the SmartDesign MSS


1. Select the voltage_monitor project in the Project Explorer window. Run SmartFusion MSS Configurator from
Run menu using Run > Run SmartFusion MSS Configurator.

Figure 4 · Running SmartFusion MSS Configurator


2. The MSS appears in the SmartDesign Canvas with a New Project dialog box, as shown below:

Figure 5 · New Project Dialog

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 9
Working with the SoftConsole

The Project Name and Project Directory parameters are already specified. Click Next.
Note: If you do not see the latest MSS version (v2.1.108 or above) as shown in Figure 5, you need to change
your repositories settings. Steps for setting up repositories are described in Appendix A -
Vault/Repositories Settings in SmartDesign.
3. Ensure that the following details are selected in the dialog box and click Next:
Family: SmartFusion
Die: A2F200M3F
Package: 484 FPBGA
4. Select Verilog (or VHDL) in the dialog box and click Finish.
Note: If your vault does not have MSS core then SmartDesign will ask to download the core. Click Yes to
download the core.
5. The MSS canvas appears as shown below:

Figure 6 · MSS Canvas


6. The enabled MSS peripherals are highlighted in blue and can be configured in hardware. The disabled peripherals
are shown in gray, and those that can be configured in firmware are shown in orange.
7. The peripherals highlighted in orange can be disabled if they are not used. To disable a peripheral, select the
peripheral, right-click, and clear the check box for Enabled. The box turns grey to indicate a peripheral has been
disabled. Disabled peripherals can be enabled by repeating the procedure.

10 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

Figure 7 · Enabling/Disabling Peripherals


Also, you can disable a peripheral by clearing the check box in the lower right corner of the peripheral box.

Figure 8 · Clear Check Box on Peripheral


For this design we will be using the ACE, UART_0, and clock management peripherals. Other peripherals must be
disabled.
8. Double-click the Clock Management block and configure as shown below:
CLKA: On-Chip RC Oscillator
MSS Clock source: PLL output
MSS clock frequency: 80 MHz
10/100CLK: Cleared check box (by default it will be cleared, if MAC is disabled)
Defaults for all other settings
9. After completing the configuration, click OK.

Figure 9 · MSS Clock(s) Configurator

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 11
Working with the SoftConsole

Configuring ACE
To configure ACE, double-click the ACE peripheral block and configure as follows:
1. TM0 is connected to the POT on the SmartFusion development board. Configure a voltage monitor to measure the
voltage across the potentiometer and also 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 will be used to monitor the voltage.

Figure 10 · Configure ACE


2. Select ADC Direct Input and click 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: un-checked
Acquisition time: 10 µs
Filtering factor: None
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

12 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

Figure 11 · Configure ADC Direct Input


3. Click OK.
4. Assign ADC Direct Input Signal to package pin W8 in the Configure ACE Dialog box.
5. The Configure ACE tab should appear, as shown in Figure 12.

Figure 12 · Configure ACE Tab

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 13
Working with the SoftConsole

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

Figure 13 · Insert Operating Sequence Slot


7. Click the Insert operating sequence slot button, highlighted in the above figure.
8. Select SAMPLE.

Figure 14 · Select SAMPLE

14 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

9. The Configure SAMPLE window will appear. Select TM0_Voltage and click OK.

Figure 15 · Configure SAMPLE


10. Click the Insert Operating Sequence slot button again and select RESTART SEQUENCE.
11. Click the Calculate Actual Rate button.
12. The final Controller tab window should appear, as shown below:

Figure 16 · Final Controller Tab Window

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 15
Working with the SoftConsole

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

Figure 17 · Flag Registers Group


14. Click the + sign to expand the Flag Registers group. The PPE_FLAGSn registers contain the user-defined flags.
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 Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

Figure 18 · ACE Flag Mapping


16. Click OK to close the ACE configuration box.
17. Select Canvas > Show Nets to display the nets in the canvas.

Figure 19 · Show Nets

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 17
Working with the SoftConsole

18. Your canvas appears as shown below:

Figure 20 · MSS Canvas


19. Save your design using File > Save POT_UART_MSS.
20. Open the Firmware tab.

Figure 21 · Firmware Tab


21. Make sure you get latest versions of the firmware and there is no warning/error saying, the core is missing from
the Vault. If so, refer to Appendix B – Firmware Catalog Settings to set your Repositories.
Note: If you are opening the SmartDesign for the first time then you need to download the all firmware drivers
from the Firmware tab in the SmartDesign.

18 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

Figure 22 · Downloading the Firmware drivers using SmartDesign

Configure SmartFusion_CMSIS_PAL_0
1. Click the configuration button as marked in Figure 23 and make sure you select SoftConsole in the Configuration
window. Also, disable the generation of the drivers for the peripherals which are not required.

Figure 23 · Select SoftConsole in the Configuration Window

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 19
Working with the SoftConsole

2. Click OK.
3. Save your design and generate.

Figure 24 · Save Design and Generate


4. Confirm that the design was successfully generated. You will get information in the Log window that the Netlist,
Firmware files, and eNVM programming file have been generated.
Note: If errors are indicated, open the log window (View > Log) to get additional information.
5. Open the memory map for the design (Design > Show Memory Map/Data Sheet). Scroll in the window to
become familiar with the locations of the peripherals. Close the window when finished.
6. Close SmartDesign (File > Exit).
7. The Project Explorer window of SoftConsole will now have CMSIS, drivers, drivers_config and
voltage_monitor_MSS directories added to your project, as shown in Figure 25.

Figure 25 · Firmware Directory Under the voltage_monitor Project

Configuring and Launching FlashPro, Generating the Programming File, and


Programming the Device
SmartFusion Evaluation Kit Jumper Settings and Connections
• JP10: Connect pin 1 and 2.
• JP7: Connect pin 1 and 2 for LCPS programming mode.
• J6: Connect pins 1 and 2 with the jumper.
• JP6: Connect pins 2 and 3 with the jumper.

20 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

• J13: Connect the mini USB cable. When the cable is inserted, FlashPro drivers might be installed if they are not
already installed.
• J14: Connect the second mini USB cable for power.

Configuring FlashPro
1. Select voltage_monitor project in the Project Explorer window. Open the External Tools dialog box using Run >
External Tools > External Tools Configurations.
2. Double-click Program to create a new configuration.
3. Enter FlashPro in the Name field.
4. Click the Browse File System button in the Location field. The Open dialog box will open.
5. Navigate to <drive> :\< Libero IDE installation folder>\Designer\bin and select flashpro.exe; then click Open.

Figure 26 · Configure FlashPro


6. Click Apply and then Run.

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 21
Working with the SoftConsole

Programming File Generation and Programming

Figure 27 · FlashPro
1. Create a FlashPro project by clicking the New Project button.
2. Enter the following in the New Project dialog box:
Project Name: POT_UART_FP
Project Location: C:\Actelprj\POT_UART_SoftConsole\Only_SoftConsole
Programming mode: Single device
Note: Project name should be different from the one used in MSS Configuration. If not, then Windows will
prompt for overwrite.

Figure 28 · New Project Dialog


3. Click OK to close the New Project dialog box. You will receive a message: “Created new project
.../POT_UART_FP.pro in the log window.”

22 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

4. Click Configure Device in the FlashPro GUI. The FlashPro GUI is displayed as shown in Figure 29:

Figure 29 · FlashPro GUI


5. Click the Create button in the Programming file section of the FlashPro GUI. Enter the following in the Create
PDB dialog box:
Device: A2F200M3F
Package: 484 FBGA
Defaults for all other settings
6. Click OK to close the dialog box. The FlashPoint – POT_UART_FP.pdb dialog box will open. Enter the
following silicon features to be programmed:
• Security settings: Not selected
• FPGA Array: Not selected
• FlashROM: Not selected
• Embedded Flash Memory: Selected

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 23
Working with the SoftConsole

Figure 30 · Silicon Features to be Programmed


7. Click the Import button for the Embedded Flash Memory. Browse in for the *.efc file located in the directory
where you created your SmartDesign project (POT_UART_MSS) using MSS_Configurator and generated the
design for the component. For example:
C:\Actelprj\POT_UART_SoftConsole\Only_SoftConsole\voltage_monitor\voltage_monitor_MSS\component\work\
voltage_monitor_MSS\MSS_ENVM_0.
File name: MSS_ENVM_0.efc
Files of type: Embedded Flash Memory Configuration Files (*.efc)

Figure 31 · Browse for EFC File

24 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 3 – Configuring External Tools (MSS and FlashPro)

8. Click Import to import the flash memory configuration file.

Figure 32 · FlashPoint – POT_UART_FP.pdb Dialog Box


9. Click Save PDB in the FlashPoint – pot_uart_fp.pdb dialog box.
10. Look for the message in the log window to indicate that the programming file has been loaded successfully.

Figure 33 · FlashPro Window


11. Click the Program button in the FlashPro GUI to program the SmartFusion device. The programmer status box
says “RUN PASSED” to indicate successful programming.
Note: Do not interrupt the programming sequence; it may damage the device or the programmer.

Figure 34 · RUN PASSED Status


12. Close FlashPro (File > Exit) when programming is complete. Click Yes if prompted to save the project.

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 25
Working with the SoftConsole

Step 4 – Configuring the Serial Terminal Emulation Program


Prior to monitoring the voltage across the potentiometer (POT), you must configure the Serial Terminal Emulation
program installed on your PC.
1. Perform the following steps to use the SmartFusion Development board:
• Connect a second mini USB cable between the USB connector on the SmartFusion Development board and a
USB port of your PC. If Windows prompts you to connect to Windows Update, select “No, not at this time”
and click Next.
• If the SFE USB to RS232 Controller drivers are automatically detected (this can be verified in the Device
Manager), as shown in Figure 35, proceed to Step 6 – Adding a New Source File; otherwise refer to Step 5 –
Installing Drivers for the USB to RS232 Bridge on page 27.

Figure 35 · RS232 Controller Drivers


2. Open the HyperTerminal application using Start > 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.
3. Enter ace in the Name field in the Connection Description dialog box, shown in Figure 36, and click OK.

26 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 5 – Installing Drivers for the USB to RS232 Bridge

Figure 36 · Connection Description


4. Select the COM port identified on the previous page from the Connect Using drop-down list in the Connect To
dialog box and click OK.
5. Set the following in the COM Properties window and click OK:
Bits per second: 57600
Data bits: 8
Parity: None
Stop bits: 1
Flow control: None
6. Next time you can directly open HyperTerminal (without configuring) by selecting All Programs > Accessories >
Communications > HyperTerminal > ace.

Step 5 – 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 lists SFE
USB to RS232 Controller under the Ports section of the Device Manager.

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 27
Working with the SoftConsole

Step 6 – Adding a New Source File (main.c) to the Project


1. To declare the main.c, select File > New > Source File.

Figure 37 · Create New Source File


2. Enter the following details:
Source File: Enter the name main.c.
Leave the rest as default.
3. Click Finish.
4. Sample code is provided below. Paste this code in main.c file below the header information.

Sample C code
#include "./drivers/mss_uart/mss_uart.h"
#include "./drivers/mss_ace/mss_ace.h"
#include "./drivers/mss_watchdog/mss_watchdog.h"
#include <stdio.h>

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

/*
* main function.
*/

int main()

28 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 6 – Adding a New Source File (main.c) to the Project

{
const uint8_t msg_under_1p0v[]= " ** No Flag: TM0_Voltage < 1V \r\b\r\b";
const uint8_t msg_over_1p0v[] = " ** Flag: TM0_Voltage_over_1p0V\r\b\r\b";
const uint8_t msg_over_1p5v[] = " ** Flag: TM0_Voltage_over_1p5V\r\b\r\b";
const uint8_t msg_over_2p0v[] = " ** Flag: TM0_Voltage_over_2p0V\r\b\r\b";
const uint8_t msg_over_2p5v[] = " ** Flag: TM0_Voltage_over_2p5V\r\b\r\b";

const uint8_t greeting[] = "\n\rWelcome to Actel's SmartFusion Voltage


Monitor\n\n\r";
const uint8_t * channel_name;

/* Disable Watchdog Timer*/


MSS_WD_disable();

/* Initialize and configure UART0. */


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 the ACE driver */


ACE_init();

/* Send greeting message over the UART */


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;

/* Voltage is displayed on the UART_0 hyperterminal */


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", channel_name,((float)(-adc_value_mv) / (float)(1000)));
}
else
{
snprintf( (char*)display_buffer, sizeof(display_buffer),"%s : %.3fV",
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);

/* Voltage flags are displayed on the HyperTerminal UART_0 */


if ( flag_status_2p5v == FLAG_ASSERTED )
MSS_UART_polled_tx( &g_mss_uart0, msg_over_2p5v, sizeof(msg_over_2p5v) );
else
if ( flag_status_2p0v == FLAG_ASSERTED )
MSS_UART_polled_tx( &g_mss_uart0, msg_over_2p0v, sizeof(msg_over_2p0v) );

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 29
Working with the SoftConsole

else
if ( flag_status_1p5v == FLAG_ASSERTED )
MSS_UART_polled_tx( &g_mss_uart0, msg_over_1p5v, sizeof(msg_over_1p5v) );
else
if ( flag_status_1p0v == FLAG_ASSERTED )
MSS_UART_polled_tx( &g_mss_uart0, msg_over_1p0v, sizeof(msg_over_1p0v) );
else
MSS_UART_polled_tx( &g_mss_uart0, msg_under_1p0v, sizeof(msg_under_1p0v));
}
return 0;
}
/*******************************************************************************/
5. Your project explorer will now show the main.c file linked to your project as shown below:

Figure 38 · Main.c File Linked to Project


6. Right-click on the project name (voltage_monitor) and click Properties.

30 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 6 – Adding a New Source File (main.c) to the Project

7. Expand the C/C++ Build node and select settings option.


8. Select Miscellaneous under the GNU C Linker. Enter the following in the Linker Flags tab.
-T ../CMSIS/startup_gcc/debug-in-actel-smartfusion-esram.ld

Figure 39 · Enter Linker Flags


9. After confirming all the settings, click Apply and OK.
10. Select your project (voltage_monitor) and perform a clean build by selecting Clean from the Project menu.
Accept the default settings in the Clean dialog box and click OK.

Figure 40 · Perform Clean Build

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 31
Working with the SoftConsole

11. Make sure there are no errors; you can ignore any warnings.
Note: If there are any compilation errors regarding the file or directory missing then use the SoftConsole
directories including feature from Project options > C/C++ Build > settings > GNU C Compiler >
Directories to include the header file directories. This enables the compiler to look in to added directories
for the included header files.

Step 7 – Running the Application


1. Select Run > Debug Configurations from the menu. The Debug dialog is displayed.
2. Double-click the Actel Cortex M3 RAM target. A screen similar to Figure 41 is displayed.

Figure 41 · Create, Manage, and Run Configurations

32 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 7 – Running the Application

3. If the C/C++ Application project is not populated, click Search Project to select the program to run.

Figure 42 · Program Selection


Now your Debug window should resemble the Figure 41 shown in step 2 above.
4. Click Apply.
5. Open the Commands tab and confirm that Initialize commands and Run commands have been populated, as
shown in Figure 43:

Figure 43 · Initialize and Run Commands

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 33
Working with the SoftConsole

6. After confirming, click Apply and Debug.


7. Click Yes when prompted to Confirm Perspective Switch. This displays the debug view mode.

Figure 44 · Confirm Perspective Switch


The SoftConsole Perspective should now resemble Figure 45.

Figure 45 · SoftConsole Perspective


8. Click the Resume key as indicated by a circle in Figure 46.

34 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 7 – Running the Application

Figure 46 · Resume Key


9. Observe the HyperTerminal window; it should the display “Welcome to Actel’s SmartFusion Voltage Monitor”.

Figure 47 · HyperTerminal Display


10. Move the POT on the SmartFusion Evaluation Kit board. The voltage measurement is displayed.
11. Adjust the POT and observe that the voltage measurement is continuously updated.

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 35
Working with the SoftConsole

Figure 48 · Voltage Measurement Continuous Update


12. Confirm that the flags work as specified in the ACE configurator.

Step 8 – Debugging the Application


You can use the following steps 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 49 · The Register Tab

36 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 8 – 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 50 · The Variables Tab


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

Figure 51 · View Assembly Level Instructions

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 37
Working with the SoftConsole

Figure 52 · 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 the 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.
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 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-
click and select Terminate and Remove.

38 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Step 8 – Debugging the ApplicationError! No text of specified style in document.

Figure 53 · 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 (File > Exit).
14. Close HyperTerminal (File > Exit). Click Yes when prompted about closing now.

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 39
Appendix A - Vault/Repositories Settings in
SmartDesign

Listed below are the steps to show how to configure your vault location and set up the repositories in SmartDesign.
1. In SmartDesign, select Options > Vault/Repositories Settings.

Figure 54 · Vault/Repositories Settings


The Settings window is displayed.
2. Click Repositories and add the following in the address field, if they are not already added:
www.actel-ip.com/repositories/SgCore
www.actel-ip.com/repositories/Firmware
www.actel-ip.com/repositories/DirectCore

Figure 55 · Add Repositories


3. Click Vault Location in the Options window.

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 41
Appendix A - Vault/Repositories Settings in SmartDesign

4. Browse to a location on your computer to set the vault location where the IPs can be downloaded from the
repositories.

Figure 56 · Browse to Set the Vault Location


5. Click OK.

42 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
Appendix B - Firmware Catalog Settings

1. Open <Libero Installation directory>\Designer\bin\catalog.exe.


2. Select Tools > Vault/Repositories Settings, from the Firmware Catalog window.

Figure 57 · Firmware Catalog Settings

Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 43
Appendix B - Firmware Catalog Settings

3. Select Repositories option under Vault/Repositories Settings dialog box.

Figure 58 · Vault/Repositories Settings


4. Confirm that the following repositories are displayed (add them if needed):
• www.actel-ip.com/repositories/Firmware
• www.actel-ip.com/repositories/SgCore
• www.actel-ip.com/repositories/DirectCore
Add the above mentioned paths in the address field if required, by selecting the repository and clicking Add.
If new cores are available for download then click Download them now! button to download the new cores to the
vault.

44 Displaying POT Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion
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 Values Over UART: SoftConsole Standalone Flow Tutorial for SmartFusion 45
Product Support

The technical support email address is [email protected].

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
([email protected]) or contact a local sales office. Sales office listings can be found at
www.actel.com/company/contact/default.aspx.

46 Displaying POT Values Over UART: SoftConsole Standalone Flow 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

50200212-2/08.10

You might also like