Overview of Code Composer Studio V 5.1

Introduction Code Composer Studio V 5.1
Larissa Swanland (behalf of the Technical Training Organization)
Texas Instruments- Microcontroller


Description

Code Composer Studio is TI's development tool for the entire Embedded Processing Portfolio.
TI University Program promotes in Universities.
Code Composer Studio is FREE for academics. Please go here for more information: CCS in Universities

This course is created as an introduction to the IDE and a basic walk-through to familiarize yourself. The training is part of the a larger 1-Day hands-on Workshop with the TI Technical Training Organization. You can find the full workshop here: One Day Workshop LaunchPad Wiki


Required Materials:
To use this material you will need to have the following:
  • An Active Installation of Code Composer Studio V 5
  • (If you do not have the above, then you will need to install it, which you can go here:
    http://ti.com/ccstudio
  • Materials (attached to this post or you can download here in PDF
  • A $4.30- MSP430 LaunchPad Development Tool part number: MSP-EXP430G2

Code Composer Studio

Introduction

This module will cover a basic introduction to Code Composer Studio. In the lab exercise we show how a project is created and loaded into the flash memory on the MSP430 device. Additionally, as an optional exercise we will provide details for soldering the crystal on the LaunchPad.

Module Topics

Code Composer Studio.............................................................................................................................................. 2-1

Module Topics......................................................................................................................................................... 2-2

Code Composer Studio.......................................................................................................................................... 2-3

Lab 2: Code Composer Studio............................................................................................................................. 2-7

Objective.............................................................................................................................................................. 2-7

Procedure............................................................................................................................................................. 2-8

Optional Lab Exercise -- Crystal Oscillator.................................................................................................... 2-14

Objective............................................................................................................................................................ 2-14

Procedure........................................................................................................................................................... 2-14

Code Composer Studio


Lab 2: Code Composer Studio

Objective

The objective of this lab is to learn the basic features of Code Composer Studio. In this exercise you will create a new project, build the code, and program the on-chip flash on the MSP430 device. An optional exercise will provide details for soldering the crystal on the LaunchPad.

Procedure

Note: CCS5.1 should have already been installed during the Lab1 exercise.

Start Code Composer Studio and Open a Workspace
  1. Start Code Composer Studio (CCS) by double clicking the icon on the desktop or selecting it from the Windows Start menu. When CCS loads, a dialog box will prompt you for the location of a workspace folder. Browse to: C:\MSP430_LaunchPad\WorkSpace and do not check the "Use this as the default ;" checkbox. Click OK.

This folder contains all CCS custom settings, which includes project settings and views when CCS is closed, so that the same projects and settings will be available when CCS is opened again. It also contains a list of your current projects. The workspace is saved automatically when CCS is closed.


  1. The first time CCS opens, the "License Setup Wizard" should appear. In case you started CCS before and made the wrong choices, you can open the wizard by clicking Help ->; Code Composer Studio Licensing Information then click the Upgrade tab and the Launch License Setup; .



If you're planning on working with the LaunchPad and value-line parts only, the
CODE SIZE LIMITED version of Code Composer with its 16kB code size limit will fully support every chip in the family.

If you are attending another workshop in conjunction with this one, like the StellarisWare workshop, you'll need to select the FREE LICENSE version. This version is free when connected to certain boards, but not the LaunchPad board. When not connected to those boards, you will have 30 days to evaluate the tool, but you can extend that period by 90 days.

Assuming that you're only attending the LaunchPad workshop, select the
CODE SIZE LIMITED radio button and click Finish.

You can change your CCS license at any time by following the steps above.

  • You should now see the open TI Resource Explorer tab open in Code Composer. The Resource Explorer provides easy access to code examples, support and Grace;. Grace; will be cover in a later module. Click the X in the tab to close the Resource Explorer.
  • At this point you should see an empty CCS workbench. The term workbench refers to the desktop development environment. Maximize CCS to fill your screen.

The workbench will open in the "CCS Edit" view. Notice the tab in the upper right-hand corner. A perspective defines the initial layout views of the workbench windows, toolbars, and menus which are appropriate for a specific type of task (i.e. code development or debugging). This minimizes clutter to the user interface. The "CCS Edit" perspective is used to create or build C/C++ projects. A "CCS Debug" perspective will automatically be enabled when the debug session is started. This perspective is used for debugging your projects. You can customize the perspectives and save as many as you like.


Create a New Project

A project contains all the files you will need to develop an executable output file (.out) which can be run on the MSP430 hardware. To create a new project click:

File--> New-->CCS Project

Make the selections shown below (your dialog may look slightly different than this one). If you are using the MSP430G2231, make the appropriate choices for that part. Make sure to click Empty Project, and then click Finish.


Code Composer will add the named project to your workspace and display it in the Project Explorer pane. For your convenience, it will also add a file called main.c and open it for editing. Click on Temperature_Sense_Demo in the Project Explorer pane to make the project active.

Source Files

  1. Next, we will add code to main.c. Rather than create a new program, we will use the original source code that was preprogrammed into the MSP430 device (i.e. the program used in Lab1).

Click File-->Open File; and navigate to C:\MSP430_LaunchPad\Labs\Lab2\Files.

Open the Temperature_Sense_Demo.txt file. Copy and paste its contents into main.c, erasing the original contents of main.c, then close the Temperature_Sense_Demo.txt file. Near the top of the file, note the statement
#include "msp430g2553.h"

If you are using an earlier revision of the board, change this statement to:
#include "msp430g2231.h"
Be sure to save main.c by clicking the Save button  in the upper left.

Build and Load the Project

  1. CCS can automatically save modified source files, build the program, open the debug perspective view, connect and download it to the target (flash device), and then run the program to the beginning of the main function.

Click on the "Debug" button

Notice the Debug icon in the upper right-hand corner indicating that we are now in the "CCS Debug" view. Click and drag the perspective tabs to the left until you can see all of both tabs. The program ran through the C-environment initialization routine in the runtime support library and stopped at main() function in main.c.


Debug Environment

The basic buttons that control the debug environment are located in the top of the Debug pane. If you ever accidentally close the pane, your Debug controls will vanish. They can be brought back by clicking View ->; Debug on the menu bar.

Hover over each button to see its function.

  1. At this point your code should be at the beginning of main(). Look for a small blue arrow left of the opening brace of main() in the middle window. The blue arrow indicates where the Program Counter (PC) is pointing to. Click the Resume button to run the code. Notice the red and green LEDs are toggling, as they did before.
  2. Click Suspend  . The code should stop somewhere in the PreApplicationMode() function.
  3. Next single-step (Step Into) the code once and it will enter the timer ISR for toggling the LEDs. Single-step a few more times (you can also press the F5 key) and notice that the red and green LEDs alternate on and off.
  4. Click Reset CPU and you should be back at the beginning of main().
Terminate Debug Session and Close Project
  1. The Terminate button will terminate the active debug session, close the debugger and return CCS to the "CCS Edit" view. Click the Terminate button:
  2. Next, close the project by right-clicking on Temperature_Sense_Demo in the Project Explorer window and select Close Project.

Optional Lab Exercise -- Crystal Oscillator

Objective

The MSP430 LaunchPad kit includes an optional 32.768 kHz clock crystal that can be soldered on the board. The board as-is allows signal lines XIN and XOUT to be used as multipurpose I/Os. Once the crystal is soldered in place, these lines will be a digital frequency input. Please note that this is a delicate procedure since you will be soldering a very small surface mount device with leads 0.5mm apart on to the LaunchPad.

The crystal was not pre-soldered on the board because these devices have a very low number of general purpose I/O pins available. This gives the user more flexibility when it comes to the functionality of the board directly out of the box. It should be noted that there are two 0 ohms resistors (R28 and R29) that extend the crystal pin leads to the single-in-line break out connector (J2). In case of oscillator signal distortion which leads to a fault indication at the basic clock module, these resistors can be used to disconnect connector J2 from the oscillating lines.

Procedure

Solder Crystal Oscillator to LaunchPad
  1. Very carefully solder the included clock crystal to the LaunchPad board. The crystal leads provides the orientation. They are bent in such a way that only one position will have the leads on the pads for soldering. Be careful not to bridge the pads. The small size makes it extremely difficult to manage and move the crystal around efficiently so you may want to use tweezers and tape to arranging it on the board. Be sure the leads make contact with the pads. You might need a magnifying device to insure that it is lined up correctly. You will need to solder the leads to the two small pads, and the end opposite of the leads to the larger pad.

    Click this link to see how one user soldered his crystal to the board:

    http://justinstech.org/2010/07/msp430-launchpad-dev-kit-how-too/

Verify Crystal is Operational

  1. Create a new project by clicking File ->; New ->; CCS Project and then make the selections shown below. Again, if you are using the MSP430G2231, make the proper choices. Click Finish.

  1. Click File -->Open File; and navigate to C:\MSP430_LaunchPad\Labs\Lab2\Files.

Open the Verify_Crystal.txt file. Copy and paste its contents into main.c, erasing all the previous contents of main.c. Then close the Verify_Crystal.txt file -- it is no longer needed.

If you are using the MSP430G2231, find the #include statement near the top of the code and replace it with #include Save your changes to main.c.

Click the "Debug" button  The "CCS Debug" view should open, the program will load automatically, and you should now be at the start of Main().

Run the code. If the crystal is installed correctly the red LED will blink slowly. (It should not blink quickly). If the red LED blinks quickly, you've probably either failed to get a good connection between the crystal lead and the pad, or you've created a solder bridge and shorted the leads. A good magnifying glass will help you find the problem.

Terminate Debug Session and Close Project

Terminate the active debug session using the Terminate button  . This will close the debugger and return CCS to the "CCS Edit" view.

Next, close the project by right-clicking on Verify_Crystal in the Project Explorer pane and select Close Project.


More Information

Other info you would like to share?

  • Your bio?
  • Additional supporting materials?
  • About your University or program?

You can Download the full workshop and the supporting materials by visiting the LaunchPad 1 Day Training Wiki-Site : http://ti.com/hands-on-training

Hope that is helpful. If you would like tutorials like this or lessons like this, please make sure to comment!

Related
Recommended