0% found this document useful (0 votes)
70 views9 pages

1541.launchpad Basics

The document provides instructions for creating a basic C2000 MCU project in Code Composer Studio that uses CPU timers to blink an LED, including adding necessary driver files from ControlSUITE, configuring include paths, initializing GPIO pins for output, and using a CPU timer to toggle the pin and blink the LED. Modifications are made to toggle additional LEDs on different GPIO pins and change the blink rate by modifying the CPU timer period register value.

Uploaded by

Surajit Saha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views9 pages

1541.launchpad Basics

The document provides instructions for creating a basic C2000 MCU project in Code Composer Studio that uses CPU timers to blink an LED, including adding necessary driver files from ControlSUITE, configuring include paths, initializing GPIO pins for output, and using a CPU timer to toggle the pin and blink the LED. Modifications are made to toggle additional LEDs on different GPIO pins and change the blink rate by modifying the CPU timer period register value.

Uploaded by

Surajit Saha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Lab 1: Guide for creating portable projects in C2000

Requisites: CCSV5.5 installed in C:\TI; ControlSUITE installed in C:\TI; C2000 PICCOLO Launchpad hardware (LAUNCHXL-F28027).

Objective: To create first project with CCS and debug. This lab will use CPU Timers and
blink an LED connected to GPIO.

Start CCS IDE. When you open CCS, you will get the “Workspace Launcher” window. Type in C:\C2000Workspace

 Close the resource explorer window and Click on File>New>New CCS Project to create a
new project.
 Enter the project name and select the microcontroller and Connections settings as
shown below:
After creating the project, click on Window>Preferences to edit the project preferences. Type
“Linked” in the search bar and select Linked resources.

Click on “New” to add a new path variable and Name it “controlSUITE”. Give the path location
as C:\ti\controlSUITE
Note: In case if your controlSUITE installation path is different, enter the location of your
controlSUITE install folder in the location field. Click OK when done.
Go to window>Preferences again, and type “Variables” in the search field. Select “Build
Variables” and click “Add” to add controlSUITE as a build variable as shown below:

Enter the variable name and path as shown below. Be sure to select the Type as “Directory”.
Note: In case if your controlSUITE installation path is different, enter the location of your
controlSUITE install folder in the “Value” field. Click OK when done.
Open Windows Explorer and navigate to
C:\ti\controlSUITE\device_support\f2802x\v129\DSP2802x_common\source
Select the following files and drag and drop them into the CCS project.
 DSP2802x_CodeStartBranch.asm
 DSP2802x _CpuTimers.c
 DSP2802x _DefaultIsr.c
 DSP2802x_Gpio.c
 DSP2802x _PieCtrl.c
 F2806x_PieVect.c
 DSP2802x _SysCtrl.c
 DSP2802x _usDelay.asm
When prompted, select “Link to files” as follows, and select “controlSUITE” in the drop down
menu:

Similarly,
Go to C:\ti\controlSUITE\device_support\f2802x\v129\DSP2802x_headers\source
Add the file DSP2802x_GlobalVariableDefs.c
Go to C:\ti\controlSUITE\device_support\f2802x\v129\DSP2802x_headers\cmd
Add the file DSP2802x_Headers_nonBIOS.cmd

To add the main example C file, go to


C:\ti\controlSUITE\device_support\f2802x\v129\DSP2802x_examples_ccsv4\cpu_timer
and select the file Example_2802x_CpuTimer.c
Note: While adding this file to the project, copy it instead of linking, as we will be modifying
this file during our exercise.
Right click on the project and select “Properties”
Navigate to Build>C2000 Compiler>Include Options
Click the “Add” icon to add the following include options

Add the following paths:


${controlSUITE}\device_support\f2802x\v129\DSP2802x_headers\include
${controlSUITE}\device_support\f2802x\v129\DSP2802x_common\include

Note: ${controlSUITE} uses the build variable “controlSUITE” to search for the file path. We had defined “controlSUITE”
as C:\ti\controlSUITE

We are done with creating a project!. Now let’s Build and Debug the program.
Build the project by clicking on the “Build” Icon (Hammer symbol)
Open file “Example_2802xCpuTimer.c” and go through the code.
Click on the “Debug” button which is next to the Build button, to enter the debug session.

Scroll to line 178 of the file “Example_2802xCpuTimer.c” and copy the variable
“CpuTimer0.InterruptCount” and Paste it in the “Expressions” window. You can also, select
the variable “CpuTimer0.InterruptCount”, right click on it and select “Add Watch Expression…”

Click this button to enable


Continuous Refresh

Enable “Silicon Realtime Debug mode enable” and then click on the green “Resume”(F8)
button to start program execution. While enabling realtime debug, you would get a
confirmation Window and you select “Yes”.

Now the program will be executing and you can see the CpuTimer0.InterruptCount getting
incremented every second. To terminate, press on the Red Stop button.
Part 2:

Objective: Toggle the LED connected on GPIO 0 pin on every second.


In the file “Example_2802xCpuTimer.c” In the, scroll to line 84 and uncomment the
“InitGpio()” function

Write the following code to enable GPIO0 as an output pin


(GpioCtrlRegs.GPADIR.bit.GPIO0=1;). Note: After entering the group name succeeded by dot
(GpioCtrlRegs.), you can press “CTRL+SPACE” keys to see the list of all group members.

Scroll to line 179 and add the following code to toggle an LED
(GpioDataRegs.GPATOGGLE.bit.GPIO0 = 1;).

Build the program, click on debug and then run. Is the LED toggling?...

The LED will NOT toggle. Note that, the GPIO control registers are EALLOW protected. Exit the
debug session and add the EALLOW and EDIS statements in the GPIO initialization code as
follows:

Now rebuild the code and execute. You will see the LED at GPIO0 toggling.

Add “CpuTimer0Regs.PRD.all” variable to the expressions window. The value is 60000000.


Change this value from the watch window to 20000000 and observe the LED blink rate.

Exercise: Try toggling the LEDs connected at GPIO1, GPIO2 and GPIO3 also.

You might also like