Vous êtes sur la page 1sur 17

Grace for Code Composer Studio IDE

Getting Started Guide

Literature Number: SLAU476 December 2012

Contents
1

2 3 4

5 6 7 8 9

........................................................................................................................ 4 ...................................................................................................... 4 1.2 Purpose of Grace ........................................................................................................ 4 1.3 Grace, MSP430Ware, and Driver Library ............................................................................ 4 Installation ......................................................................................................................... 5 Starting a Grace Project ....................................................................................................... 6 Device Configuration ......................................................................................................... 10 4.1 G2xx and F2xx Device Family Peripheral Configuration ......................................................... 10 4.2 FR5xx Device Family Configuration ................................................................................. 12 Build the Project ................................................................................................................ 12 GPIO Configuration ........................................................................................................... 13 Grace Snippets ................................................................................................................. 14 Review the Generated Source Code ..................................................................................... 15 Interrupt Handling ............................................................................................................. 15
Introduction
1.1 Supported Devices

Table of Contents
Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

www.ti.com

List of Figures
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CCS Setup, Processor Support ........................................................................................... 5 CCS Setup, Select Components .......................................................................................... 5 Workspace Launcher, Select a Workspace ............................................................................. 6

........................................................................................................... 6 ................................................................................................... 7 Grace Welcome Screen .................................................................................................... 8 Device Overview ............................................................................................................ 9 Screen Tips .................................................................................................................. 9 Timer_A3 Use Cases ..................................................................................................... 10 Basic User Mode .......................................................................................................... 11 Configure Timer Peripheral .............................................................................................. 12 Build a Project ............................................................................................................. 12 GPIO Configuration, Pinout View ....................................................................................... 13 GPIO Configuration, Power User View ................................................................................. 13 Activate Grace Snippets .................................................................................................. 14 Header File for Grace Snippets.......................................................................................... 14 Project Explorer, Generated Source .................................................................................... 15 Timer Capture/Compare Block #0 ....................................................................................... 15 Interrupt Vector List ....................................................................................................... 16 Interrupt Vector Code ..................................................................................................... 16
New CCS Project New CCS Project Setup

Code Composer Studio, MSP430 are trademarks of Texas Instruments. SLAU476 December 2012 Submit Documentation Feedback
Copyright 2012, Texas Instruments Incorporated

List of Figures

Getting Started Guide


SLAU476 December 2012

Grace for Code Composer Studio IDE

Introduction
Grace aids developers who are using MSP430 microcontrollers by providing an intuitive way of configuring devices. The user can select from a variety of use cases and add customized settings. Grace then generates the configuration code.

1.1

Supported Devices
At present, Grace supports the following devices: All MSP430F2xx devices All MSP430G2xx devices (MSP430 Value Line) All MSP430FR57xx, MSP430FR58xx, MSP430FR59xx (FRAM devices)

1.2

Purpose of Grace
The code that is generated by Grace covers only device initialization. After this initialization, the first function that is usually executed in the main function, and there is no further interaction of Grace with the user code.

1.3

Grace, MSP430Ware, and Driver Library


For the MSP430FR5xx devices, a low-level library (Driver Library) is available. Grace uses the Driver Library for configuring the MCU. The Driver Library is a part of MSP430Ware; therefore, Grace requires that MSP430Ware is installed. Users can use Driver Library in their own user code. Direct register access is also possible. The MSP430G2xx and MSP430F2xx devices are not supported by the Driver Library. Therefore, Grace directly accesses the peripheral registers. The Driver Library API documentation can be found in the TI resource explorer. Select "TI Resource Explorer" from the "View" menu. Then select MSP430WareLibraries DriverLibUser's Guide for the documentation.

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

www.ti.com

Installation

Installation
Grace is included in the Code Composer Studio 5 default installation for MSP430. If you do not have Grace installed, you can reinstall it by running the CCSv5 setup (see Figure 1), and selecting the Grace installation option (see Figure 2).

Figure 1. CCS Setup, Processor Support

Figure 2. CCS Setup, Select Components

SLAU476 December 2012 Submit Documentation Feedback

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

Starting a Grace Project

www.ti.com

Starting a Grace Project


When starting CCS, you can select a workspace for your projects. In most cases, the default setting is fine, so click OK (see Figure 3).

Figure 3. Workspace Launcher, Select a Workspace When CCS has finished the startup process, start a new Grace-enabled MSP430 project. 1. Click "File" "New" "CCS Project" (see Figure 4).

Figure 4. New CCS Project

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

www.ti.com

Starting a Grace Project

2. 3. 4. 5.

In the New CCS Project wizard (see Figure 5), chose a name for the Project. Select the MSP430 device that is being used in the drop-down menu. Chose "Empty Grace Project" in the "Project templates and examples" section. Click OK.

Figure 5. New CCS Project Setup

SLAU476 December 2012 Submit Documentation Feedback

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

Starting a Grace Project

www.ti.com

When the loading process has completed, the Grace Welcome screen opens (see Figure 6). Much useful information is being presented here, including basic usage instructions and helpful links. It is a good idea to spend some time reading this page.

Figure 6. Grace Welcome Screen

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

www.ti.com

Starting a Grace Project

Click on the "Device Overview" link to get an overview of the device's peripherals (see Figure 7). You can navigate to any peripheral that is shown as a blue box by clicking on it. You can also navigate by clicking on the arrow in the top bar. Notice the green checkmarks in some of the boxes. These checkmarks indicate that Grace can generate initialization code for these peripherals.

Figure 7. Device Overview Click on one of the blue boxes (for example, a Timer) to open the peripheral configuration screen. Note that configuration of peripherals for the G2xx and F2xx device families differs from configuration for the FR5xx device families. Many setting options feature screen tips that are shown when the mouse cursor hovers over a configurable item on the screen (see Figure 8).

Figure 8. Screen Tips

SLAU476 December 2012 Submit Documentation Feedback

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

Device Configuration

www.ti.com

Device Configuration
There are two different methods for configuration, depending on the device family you are using. F2xx and G2xx devices use the configuration method similar to Grace 1.x (see Section 4.1). FR5xx devices use the new Use Case configuration mode (see Section 4.2). These methods are described separately in the following sections.

4.1
4.1.1

G2xx and F2xx Device Family Peripheral Configuration


Overview Screen The Overview screen allows you to enable a peripheral and presents you with some basic use-cases that you can use as a starting point for your own code (see Figure 9). Check the "Enable in my configuration" to allow Grace to configure this peripheral.

Figure 9. Timer_A3 Use Cases The "Introduction" section gives a short explanation of the peripheral's capabilities. The Use-Cases that are shown below this introduction contain instructions on how to configure the peripheral. You can also copy the User Code for the Use Case by right-clicking on the code itself, chose "Select All" from the menu, right click again, and select "Copy". You can then paste the user code into your own program.

10

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

www.ti.com

Device Configuration

4.1.2

Basic and Power User Views The "Basic User" view (see Figure 10) shows the most important configuration options and can be reached via the link at the top. If you require additional options, use the "Power User" view for a more complex setup. For most use cases, the Basic User view is sufficient.

Figure 10. Basic User Mode Note that the settings performed in one view are automatically reflected in the other views. The more complex settings that are possible in the Power User view are hidden in the Basic User view. It is therefore possible to switch from the Basic View to the Power User View and back again. The Register view shows the register settings that result from the selected configuration.

SLAU476 December 2012 Submit Documentation Feedback

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

11

Build the Project

www.ti.com

4.2

FR5xx Device Family Configuration


When selecting a peripheral on an FR5xx device, the use cases of the peripheral are presented. Check the "Configure" box to allow Grace to configure this peripheral. Select a use case to enable it and show the available configuration options (see Figure 11). Some Use Cases feature an "Advanced Settings" checkbox that enables the setting of additional options; for example, clock divider settings. You can go back to the Use Case Selection screen at any time to change the peripheral's operation to a different Use Case. Note that the timers allow several use cases to be configured simultaneously. Grace automatically checks the available timer resources and allows only valid configurations.

Figure 11. Configure Timer Peripheral

Build the Project


Press the build button (the hammer icon) on the top to start the build process (see Figure 12). If a target is connected to the PC, you can start a debug session by clicking the bug icon.

Figure 12. Build a Project

12

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

www.ti.com

GPIO Configuration

GPIO Configuration
GPIO configuration should be the last step when configuring a device (see Figure 13). IOs that are used for a peripheral function should be configured in the peripheral view as described in Section 4.1 and Section 4.2. The GPIO view shows graphical depictions of the available device packages (see Figure 13). It shows the current configuration. Next to each pin is a drop-down menu that allows you to configure the pin as an input, output, or a specific peripheral function. Note that configuring a pin manually to a peripheral function does not activate the peripheral or configure it to use the pin.

Figure 13. GPIO Configuration, Pinout View There is also a Power User view in which additional IO settings can be performed (see Figure 14). Switching from one view to the other does not change the configuration. Settings that are made in the Power User view might not be visible in the package views, but they are still present.

Figure 14. GPIO Configuration, Power User View

SLAU476 December 2012 Submit Documentation Feedback

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

13

Grace Snippets

www.ti.com

Grace Snippets
Grace 2 allows you to insert predefined code templates called "Grace Snippets". These templates are device-specific and contain C code that helps program the device. The snippets range from simple port I/O settings to complex interrupt handler functions. Make sure to activate the Grace snippets as mentioned in the "Getting Started" section of the "Welcome" screen (see Figure 15).

Figure 15. Activate Grace Snippets To use Grace Snippets, you can insert the code by opening a C file in the editor view and then doubleclicking on the snippet on the right side. You can also drag and drop the snippets to the cursor position. Note that for the FR5xx devices, you have to insert the peripheral specific "!Header file include" at the top of the C file before you can use a snippet for that peripheral (see Figure 16).

Figure 16. Header File for Grace Snippets

14

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

www.ti.com

Review the Generated Source Code

Review the Generated Source Code


After the build, the generated source can be found in the Project Explorer in the srcgrace folder (see Figure 17).

Figure 17. Project Explorer, Generated Source

Interrupt Handling
Grace can manage peripheral interrupts very efficiently. The configuration of interrupts is possible in the corresponding peripheral view (see Figure 18) or in the "Interrupt Vector List" (see Figure 19). Click the "View All Interrupt Handlers" link in the peripheral views to view the Interrupt Vector List.

Figure 18. Timer Capture/Compare Block #0

SLAU476 December 2012 Submit Documentation Feedback

Grace for Code Composer Studio IDE


Copyright 2012, Texas Instruments Incorporated

15

Interrupt Handling

www.ti.com

Figure 19. Interrupt Vector List The interrupts can be programmed in the InterruptVectors_init.c file, which is located in the Grace source folder (see Figure 20). It can also be accessed by clicking on the "Open Interrupt Vector File" link located in the Interrupt Vector List. Add your own code between the "USER CODE START" and the "USER CODE END" tags in the interrupt function. Do not make any modifications outside these tags, as they are overwritten at the next build process. If you chose to remove the interrupt handler code at a later time, any code that you entered is moved to the end of the file as a comment.

Figure 20. Interrupt Vector Code


16 Grace for Code Composer Studio IDE
Copyright 2012, Texas Instruments Incorporated

SLAU476 December 2012 Submit Documentation Feedback

IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All semiconductor products (also referred to herein as components) are sold subject to TIs terms and conditions of sale supplied at the time of order acknowledgment. TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TIs terms and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily performed. TI assumes no liability for applications assistance or the design of Buyers products. Buyers are responsible for their products and applications using TI components. To minimize the risks associated with Buyers products and applications, Buyers should provide adequate design and operating safeguards. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI. Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional restrictions. Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use of any TI components in safety-critical applications. In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TIs goal is to help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and requirements. Nonetheless, such components are subject to these terms. No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties have executed a special agreement specifically governing such use. Only those TI components which TI has specifically designated as military grade or enhanced plastic are designed and intended for use in military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and regulatory requirements in connection with such use. TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of non-designated products, TI will not be responsible for any failure to meet ISO/TS16949. Products Audio Amplifiers Data Converters DLP Products DSP Clocks and Timers Interface Logic Power Mgmt Microcontrollers RFID OMAP Applications Processors Wireless Connectivity www.ti.com/audio amplifier.ti.com dataconverter.ti.com www.dlp.com dsp.ti.com www.ti.com/clocks interface.ti.com logic.ti.com power.ti.com microcontroller.ti.com www.ti-rfid.com www.ti.com/omap TI E2E Community e2e.ti.com www.ti.com/wirelessconnectivity Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265 Copyright 2012, Texas Instruments Incorporated Applications Automotive and Transportation Communications and Telecom Computers and Peripherals Consumer Electronics Energy and Lighting Industrial Medical Security Space, Avionics and Defense Video and Imaging www.ti.com/automotive www.ti.com/communications www.ti.com/computers www.ti.com/consumer-apps www.ti.com/energy www.ti.com/industrial www.ti.com/medical www.ti.com/security www.ti.com/space-avionics-defense www.ti.com/video

Vous aimerez peut-être aussi