Home
Lab Exercise
Contents
1. il Tiva Launchpad BTN 1 12 13 lab activity G
2. means that the line is commented out and should be ignored It is not part of the project It allows the designer to be able to have both Lab1 and Lab2 in a single file By commenting or uncommenting the define Lab x it brings the first or second lab online The benefit of this is that it allows the designer to be able to define global constants such as the LED_RED assignment once and use it for multiple projects These files are operated upon sequentially from top to bottom Another new statement is the while 1 This means do all statement below this forever A final new syntax is the for loop The statement means that there is an integer called i As long asi is less than a really big number chosen at random in this lab we did two or four million keep adding 1 to it Once i gets to the really big number bounce out of the loop and keep going to the next line This allows the lights to remain a certain color for a pleasing amount of time lab activity The next step is to build the project into an executable Click on Project Build All Another way to accomplish this is by clicking the control and B keys at the same time ee ee s oo oi F11 Debug Configurations Next it is time to program the board Click on Run and then Debug as shown in Figure 11 Another shortcut is to hit the F11 key debug gt w LED Code Composer Studio Device Debugging Da a Stellaris In Circuit De
3. TI ARM Lab 3 National Blinking Lights Science Foundation Funded in part by a grant from the National Science Foundation DUE 1068182 Acknowledgements Developed by Craig Kief Brian Zufelt and Jacy Bitsoie at the Configurable Space Microsystems Innovations amp Applications Center COSMIAC Co Developers are Bassam Matar from Chandler Gilbert and Karl Henry from Drake State Funded by the National Science Foundation NSF Lab Summary This lab builds upon the second lab which turned on a light This lab will go through the process of showing the define syntax as well as the looping syntax for developing a delay Lab Goal The goal of this lab is to continue to build upon the skills learned from previous labs This lab helps the student to continue to gain new skills and insight on the C code syntax and how it is used in the TI implementation of the ARM processor Each of these labs add upon the previous labs and it is the intention of the authors that the student will build with each lab a better understanding of the ARM processor and basic C code Even though these tutorials assume the student has not entered with a knowledge of C code it is the desire that by the time the student completes the entire series of tutorials that they will have a sufficient knowledge of C code so as to be able to accomplish useful projects on the ARM processor As each tutorial is presented a higher level of abstraction will be introduced This i
4. LED RED set LED PORT F pins high for i 0 i lt 3000000 i delay GPIO PORTF DATA R 0 clear all PORT F GPIO PORTF DATA R LED RED set LED PORT F pins high for i 0 i lt 4000000 i delay endif Description Resource a Errors 1 item 1965 cannot open source file inc tm4cl23gh6pm h main c amp Warnings 1 item Figure 5 1965 Error When you attempt to do Project gt Build all you might get an error similar to the one shown in Figure 5 This error would say something similar to 1965 cannot open source file inc tm4c123gh6pm h This means that the includes are not set properly for the main project Here is an easy set of steps to fix this First go back to the main installer as shown in Figure 6 Double click on the shown installer This will install TivaWare_C_Series 2 1 0 12573 The complicated part is that there is a large quantity of different versions of TivaWare floating around This is often like hitting an object floating on the ocean To make sure everything works well in all the tutorials install this version of TivaWare lab activity gt ATE_uC_ Workshop Name Date modified Type Size I ATE uC Workshop 6 9 2014 2 08 PM File folder J CCS6 0 0 00190_win32 6 9 2014 10 39 AM File folder I ICDI 6 9 2014 2 08PM_ File folder I LMFlashProgrammer 6 9 2014 2 08 PM File folder A SW TM4C 2 1 0 12573 exe 5 30 2014 3 20PM Application 154 916 KB er Figure 6 T
5. 1 pdf Lab Procedure 1 Install Connect board to computer Step 1 Plug in the supplied USB cable to the top of the Evaluation Kit Ensure the switch on the board is set to DEBUG and not DEVICE It is assumed that the evaluation board is properly installed and operating Launch the Code Composer software The easiest way to find the executable is to go to Start All programs and then look in the area identified in Figure 1 Code Composer Figure 1 Launching Code Composer Select a workspace Code Composer Studio stores your projects in a folder called a workspace Choose a workspace folder to use for this session Workspace SRS Browse _ Use this as the default and do not ask again Figure 2 Workspace Launcher The designer will be presented with the choices shown in Figure 2 The Code Composer again wants to know where the workspace is located If you have installed the small zip file from the end of Lab 1 Lab Procedure 3 then the installer will have loaded a lot of tutorial files to your C root directory in a directory called workspace_ATE Use this as the location for your select a workspace choice shown in Figure 2 Click OK lab activity Project Explorer 5 Getting Started amp La i gt Lab Lab 4 Lab 5 New Browse lt Import gt App Lab 6 uy Project Examples U Project tj Center gt Lab i gt Lab 8 amp Lab 9 Would you like to use CCS in Simple mode Yes am
6. bug Interface CORTEX_M4_0 Suspended HW main at main c28 Ox00000268 _c_int0O0Q OxO000020E _c_intO0 has only skeletal debug info Figure 12 Stopping at main Highlight the main file as shown in Figure 12 and then click Resume green triangle The red green and yellow lights should begin flashing The final step is to modify the code to change the colors sequence of colors and the amount of delay time Attachment 1 main c solution file EEA EEE EE EA AL Ee LE RT ee EERE Re a DE Project LED LAB 2 3 ATE Launchpad Version 1 0 Date 2 20 2013 Author Brian Zufelt Craig Kief Company COSMIAC UNM Comments This Code is intended to show how to connect compile a write your first project on the Tiva C Launchpad Board FERRE KKK KKK EE KKK EE EE ER EE A EE A EE A ER EE KE AK KK EK KK KK KK Chip type ARM TM4C123GH6PM Program type Firmware Core Clock frequency 80 000000 MHz a include lt tm4c123gh6pm h gt include lt stdint h gt definitions define LED RED 0x02 define LED BLUE 0x04 define LED_GREEN 0x08 Lab definitions for the 2 versions of the lab define Lab2 define Lab3 void main void long unsigned int i 0 general counter SYSCTL_RCGC2_R SYSCTL_RCGC2_GPIOF GPIO PORTF DIR R LED RED LED BLUE LED GREEN GPIO PORTF DEN R LED RED LED BLUE LED_ GREEN Hifdef Lab2 GPIO PORTF DATA R 0 GPIO_PORTF_DATA_R LED REDILED BLUE LED_ GREEN end
7. if loop forever while 1 ifdef Lab3 GPIO PORTF DATA R 0 GPIO PORTF DATA R LED GREEN for i 0 i lt 2500000 i for i 0 i lt 4000000 i GPIO PORTF DATA R 0 GPIO PORTF DATA R LED GREEN LED RED lab activity enable PORT F GPIO set PORT F as output enable digital PORT F clear all PORT F set LED PORT F pins high clear all PORT F set LED PORT F pins high delay delay clear all PORT F set LED PORT F pins high 10 lab activity for i 0 i lt 2000000 i delay GPIO PORTF DATA R 0 clear all PORT F GPIO PORTF DATA R LED GREEN LED RED set LED PORT F pins high for i 0 i lt 3000000 i delay GPIO PORTF DATA R 0 clear all PORT F GPIO PORTF DATA R LED RED set LED PORT F pins high for i 0 i lt 4000000 i delay endif 11 lab activity Attachment 1 Block Diagram of the Pins Used in Projects a az 31 a072 Ji 21 Pa Pin Number 7 6 5 4 3 2 10 CORE Hex Binary o0 0 060 0 60 0 Pav Port A Pin 7 To energize send 0x80 PA ORK IN CIRCUIT DEBUGGER USB Pc PA 1 TX ICD GPIO A PAb ORBIT SW 2 WH ORBIT SW 1 IC PBS ORBIT LED 4 oh SDA PB 3 t ra ses PC 6 ORBIT LED 1 GPIOC PC ORBITLED 2 GPIOD PD ORBITLED 3 ORBIT PO 2 ORBITBIN1 PEO GPIOE ORBIT BTN 2 PFO Tiva Launchpad BTN 2 PFI Tiva Launchpad LED RED PF2 Tiva Launchpad LED BLUE PF3 VOC Tiva Launchpad LED GREEN
8. ivaWare Installer Once it is complete it is possible to go into the root TI directory as shown in Figure 7 There may be multiple versions of TivaWare For the remainder of these tutorials we will use Series 2 1 I gt ThisPC OS C ti Name Date modified Type Size JL ccsv6 5 28 2014 2 47PM File folder A TivaWare C Series 1 1 5 28 2014 3 53 PM File folder ES I TivaWare C Series 2 1 0 12573 6 9 2014 3 02 PM File folder kl xdctools_3 30 01 25 core 5 26 2014 2 16 PM File folder ne Code Composer Studio 6 0 0 5 28 2014 2 46 PM Shortcut 2 KB older Figure 7 TI Root Directory The way to clear the error for this and all other projects is to include the path into the project for the version of TivaWare shown above Go into Project and then to Properties in CCS Under the add directory in the center of the GUI click on the green plus symbol as shown in Figure 8 gt Resource General 4 Build Configuration Debug Active v Manage Configurations 4 ARM Compiler Processor Options Optimization Add dir to include search path include_path I amp 3 2 Include Options CG_TOOL_ROOT include MISRA C 2004 Advanced Options gt ARM Linker Figure 8 Project Properties Once the green plus symbol is checked go to the file system option as shown in Figure 9 lab activity E Getting Started main c 2 6 Auth Properties for Lab 3 7 Compa 8 Comme e filter text i o This typ Include Options 1 a w
9. ode is intended to show how to connect compile lab activity a write your first project on the Tiva C Launchpad Board DEK EK KE AK AK AK IE KK AK AK KK AE AK A AK A A A OK AE AK KK AK AK AE OK AK AK AK AK AB A AK AR AK AE AK KK AE AK AK KK OK KK KK Chip type ARM TM4C123GH6PM Program type Firmware Core Clock frequency 80 000000 MHz ee EEE include lt tm4c123gh6pm h gt include lt stdint h gt definitions define LED RED 0x02 define LED BLUE 0x04 define LED GREEN 0x08 Lab definitions for the 2 versions of the lab define Lab2 define Lab3 void main void long unsigned int i 0 general counter SYSCTL_RCGC2_R SYSCTL_RCGC2_GPIOF enable PORT F GPIO GPIO PORTF DIR R LED RED LED BLUE LED GREEN set PORT F as output GPIO PORTF DEN R LED RED LED BLUE LED GREEN enable digital PORT F ifdef Lab2 GPIO PORTF DATA R 0 clear all PORT F GPIO PORTF DATA R LED RED LED BLUE LED GREEN set LED PORT F pins high endif loop forever while 1 ifdef Lab3 GPIO PORTF DATA R 0 clear all PORT F GPIO PORTF DATA R LED GREEN set LED PORT F pins high for i 0 i lt 2500000 i delay for i 0 i lt 4000000 i delay GPIO PORTF DATA R 0 clear all PORT F lab activity GPIO_PORTF_ DATA R LED GREEN LED RED set LED PORT F pins high for i 0 i lt 2000000 i delay GPIO_PORTF_ DATA R 0 clear all PORT F GPIO PORTF DATA R LED GREEN
10. p No Recommended for Energa and LaumchPad users 2 an ak Oo Videos Q Training J Wiki LE y orum A Figure 3 Project Start Screen The user should be presented with a screen similar to that shown in Figure3 Itis possible now to see all the different projects for the remaining tutorials that have been created Open main c as shown in Figure 4 Copy the code presented below Figure 4 below and replace the code in your main c wy Lave if 4 amp Lab 3 Active Debug 2 i Includes 3Project LED LAB 3 ATE Launchpad amp Debug AVersion 1 0 5 Date 2 20 2013 amp targetConfigs 6 Author Brian Zufelt Craig Kief l main c 7Company COSMIAC UNM tm4c123gh6pm_startup_ccs c 8 Comments tm4c123gh6pm cmd 9This Code is intended to show how to connect compile tS Lab 4 10a write your first project on the Tiva C Launchpad Board amp Lab 5 11 This lab extends the code from Lab 2 to toggle the RGB E Lab 6 ms asi Z Lab 7 1A KKK KK KKK KKK KKK KKK KKK KKK KKK RK KR KKK KKK KKK KKK KKK KKK KKK KKK Lab 8 15Chip type ARM TM4C123GH6PM Lab 9 16 Program type Firmware 17 Core Clock frequency 80 000000 MHz 1G Taataa a AE 19 20 21 void main void 22 23 Figure 4 Main c ESE RRR EAE a eh Arash ae eee tye Rs eee eR Rae Re ae a A Ts ee RED Project LED LAB 2 3 ATE Launchpad Version 1 0 Date 2 20 2013 Author Brian Zufelt Craig Kief Company COSMIAC UNM Comments This C
11. ri Resource 11 General 12 4 Build Configuration Debug Active v Manag UE brer 4 ARM Compiler 14 Chip Processor Options Xx i 15 Progr ances ve Add directory path ae Optimization 16 Core 17 000 Include Options Directory 18 incl MISRA C 2004 19 incl gt Advanced Option 20 gt ARM Linker 21 de ARM Hex Utility Dis Debug 23 defi 24 defi Cancel Workspace File system 25 defi 26 x 27 La Browse For Folder x 28 de 29 defi Select a folder from file system gt I utils I TivaWare_C Series 1 1 lt gt a TivaWare_C Series 2 1 0 12573 I boot_loader I cc3000 I docs gt driverlib D Show advanced settings gt I examples I grlib J inc I lQmath I nfclib n l Console CDT Build Console Lab 9 c ti ccsv6 utils bin gmake k all gmake Nothing to be done for all Build Finished Folder TivaWare_C_Series 2 1 0 12573 Make New Folder Cancel ive Pe Figure 9 Adding the Include Files from TivaWare Include the upper level of the Tivaware directory and when complete go back to CCS and then do Project then Build All This should complete with no errors warnings about different versions for creating the project are fine Before proceeding to debugging it is important to investigate several new aspects in the code that were not in previous labs There are several new constructs in this source code that should be explained The fi
12. rst is the define This is a preprocessor directive inherited from C that takes the form define identifier value lab activity In general it is used to tell the preprocessor to replace all instances of identifier in the code with the given text before passing it on to the compiler 23 define LED RED x 2 24 define LED BLUE xe4 25 define LED GREEN x 8 26 2 Lab definitions for the 2 versions of the lab 28 define Lab 29 define Lab3 30 31 void main void 32 33 long unsigned int 1 0 feeneral counter LA fs 36 SYSCTL_RCGC2_R SYSCTL_RCGC2_GPIOF enable PORT F GPIO Nd Lt Lid md GPIO PORTF DIR R LED RED LED BLUE LED GREEN set PORT F as output Lat b D oO 10 GPIO PORTF DEN R LED RED LED BLUE LED GREEN enable digital PORT F 41 ifdef Lab 42 GPIO PORTF DATA R 0 clear all PORT F 43 44 GPIO PORTF DATA R LED RED LED BLUE LED GREEN set LED PORT F pins high A5 46 endif AT I Figure 10 define Example In the case of line 23 in Figure 10 it is used to say everywhere that LED_RED appears replace it with 0000 0010 Another example is line 29 from Figure 10 It is now possible to have multiple projects within a single file and by commenting or uncommenting the various define statements it is possible to include or exclude various sections This is shown as follows If the designer has a statement define Lab2 as in line 28 this
13. s done to allow future work to be achieved on a wide variety of different processors Learning Objectives The student should begin to become familiar with the complier and understand the use and modification of a main c file In addition the student should begin to understand the concept of a for loop Grading Criteria N A Time Required Approximately one hour Lab Preparation It is highly recommended that the student read through this procedure once before actually using it was a tutorial By understanding the final goal it will be easier to use this as a tutorial as a learning guide Up through Lab 2 it is possible to do the labs with just what is shown in the labs themselves However from here forward it is best to be able to just download the group of lab projects and install them Equipment and Materials Access to Tiva TM4C123G LaunchPad software and evaluation kit EK RM4C123GXL It is assumed that the student has already completed Lab 2 and the software is installed properly Have already installed the Code Composer Studio software from the instructions in Lab 1 Download and install the Lab Tutorials from this site http cosmiac org Community Portal Micro html Hardware needed lab activity The hardware required is the TI Tiva LaunchPad Kit Additional References The Evaluation Board user s manual is on this web site http datasheet octopart com EK TM4C123GXL Texas Instruments datasheet 1554212
Download Pdf Manuals
Related Search
Related Contents
SPIP 1. Informations générales sur le logiciel IBBICKI) - ECOrepa, le support technique et service après vente des VXi Tria V Logiciel (Network TWAIN Driver) Copyright © All rights reserved.
Failed to retrieve file