Lab1 - Getting Started
Lab1 - Getting Started
All the labs in the course have been developed by Gabriel Wainer based
on previous work done by Cheryl Schramm, Trevor Pearce, Paulo
Garcia, Mohamed Atia, and with the collaboration of Sebastien Cook and
Alec Jeffery
This lab focuses on how to download, install, and test the Keil development environment and all supporting
libraries and sample programs for the MSP432P401R Launchpad. You have two options: follow all the
steps below or use the Lab equipment where the software is installed for you. Optional: basic C programming
on the board.
Objectives:
• [Optional] Preparing the development environment on one’s own computer.
• First experience within the development environment on building and downloading a program
• Learning to use TI’s Resource Explorer
• Execution of standard test codes that can be used repeatedly to verify that hardware is working.
• Writing your first C program from scratch.
This part of the lab may be done at home, on your own time, so that you can work on future labs at home.
You may skip this step if you are using the lab machines. If your home computer has problems you can
always work in the lab.
1. Download KEIL uVision MDK-Arm – Development Environment for Cortex and Arm devices (IDE)
URL: http://www2.keil.com/mdk5/install/
- The file is MDK537.exe (856MB). You will need to register with ARM, and use the LITE version (limited
to programs of 32 KB). When registering, there is no need to enter the type of board being used; if you want,
type MSP432P401R. If you do not want to use your personal information, please use the University
information (address, phone number); available online.
- After downloading, run the executable file to install the program.
- Use the default location when installing. Pay attention in which folder Keil is installed (Default Location:
c:\Keil_v5). If you don’t use this folder, some things will not work exactly as described in this manual or
future example materials. All the materials are designed with this configuration in mind.
- Keil will run automatically after completing the installation.
2. Configure the Keil development environment to use the MSP432P401R Launchpad. Configuration is
needed because Keil (and most other embedded IDEs) work for various microcontrollers. The configuration
setup will be used to identify for which hardware you want to develop programs – in our case, the
MSP432P401R (Red).
At this stage, you will also learn to navigate both the installed sample programs and the Texas Instruments
TI Resource Explorer.
a) Read the Getting Started reference, scrolling down to Install Software Packs.
http://www2.keil.com/mdk5/install
• Make sure that you know how to find the following: Devices, Packs, and Examples tabs.
b) Open up KEIL. If it is the first time that the program has been run, a special dialog window will
be displayed. If not, please click the Pack Installer icon (shown in the red circle in the figure above).
c) Using both the Getting Started reference, and the image below, install the packages using:
• On the Devices tab: search for the MSP432P401R in the Search box (see screen capture below)
• On the Packs tab choose Device Specific: Texas Instruments, and click on Install for the Device Family
Pack for TI SimpleLink™ MSP432 Series.
• Click on Install for 3.2.6 (2018-10-31) (date and version number may change as time goes on). When
completed “Up to date” will be displayed, as below.
3. Download and install TExaS, a suite of drivers and sample programs written by Jonathan Valvano that we
will use to test our hardware. The suite contains many projects for Keil as well as projects using a Real-Time
Operating System (RTOS).
URL : http://edx-org-utaustinx.s3.amazonaws.com/UT601x/RTOSdownload.html
• Scroll down to subtitle Step 2) TExaS Lab Graders for Labs 1 to 5
• Click on the link: Download Texas Labs 1,2,3,4,5
• The file is RTBN_Install.exe.
• After downloading, run the executable file to install the suite in the Keil folder
• Using Windows explorer, ensure that a folder was put in C:\Keil_v5\MSP432ValvanoWare
4. Download and install Windows drivers for the MSP432 LaunchPad board
• It is recommended that to always to download the latest drivers.
• You will need to create a TI account, but it is free; however, as part of the procedure, you will have to sign
an U.S. Government export agreement.
• Use your Carleton University credentials
• If the Postal Code is an issue, please enter: 32259. If that does not work, try Carleton’s postal code (K1S
5B6) – with space and with capital letters.
5. We want to verify the installation by running an Example project. Get a copy of the BlinkLED example
program (see Figure below). (If you are in the lab, the Examples are already installed; look for them in the
lab computer)
• Choose a Destination Folder
• Get organized now! Create a SYSC3310 folder for all your work this term.
• You can either click or un-click the Checkbox for “Launch uVision”.
• If you do not click it, using Windows File Explorer, navigate to the Destination Folder chosen in the
previous step (See Figure below)
• Continue navigating into the subfolders down to : Examples\BlinkLED (start here if you are using the lab
machines)
a. Examples\BlinkLED is your project folder
b. Here you will see a file called blinkLED.c. This is your program
c. You will also see multiple subfolders for different hardware. All three architectures reference the same
folder. They just build the executable program differently, depending on the memory maps and instruction
sets of the particular microcontroller.
d. We are using an ARM; in that folder you will find a file called BlinkLED (uVision5 Project file) (with a
green-and-white icon). This is your project file.
e. Double-click on the project file to open Keil and compile that project
Tip: Ultimately, we are going to be writing C programs, stored in a .c file; but when working within an IDE
such as Keil or Code Composer, you also generate and build projects. A project is defined as a set of
folders and files – including the C program file (.c) – that work together to build an executable for a
particular computer.
Pay attention to which word is used: Project or Program.
6. BEFORE COMPILING: Install the ARM Compiler v5 (v6 is not compatible with examples)
(this step is not needed in the lab: the compiler is already installed)
• Extract the contents from the archive “CompilerV5.zip” (available on Brightspace)
• Go to the “Installer” folder, and select “setup” to start the Setup Wizard
• IMPORTANT! Once you are ready to install, DO NOT hit “Next” yet on the Custom Setup page.
The ARM Compiler v5 folder needs to be placed inside the “Keil_v5\ARM\” folder. To do this hit the
“Browse…” button
Note: if it is not added to the “Keil_v5\ARM\” folder, you will get an error trying to build the project
(“License could not be found”).
• If your PC already has an ARM Compiler v5 (or if you installed it in the default folder by mistake), it
will show this selection menu. Simply hit “remove” to uninstall the previous download. Start the steps
discussed above over again to re-install.
• In your Keil_v5 folder, make sure to create a new empty folder called ARM_Compiler_5.06.7 for
the files to be added to (the setup wizard has a “create a new folder” button you can use for this).
o If you do not make a new empty folder, all the downloaded files will be added straight to the ARM
folder and you will have to delete them, then restart these installation steps.
o Once you have selected the ARM folder and created your new “ARM_Compiler_5.06.7” folder, select
this newly created folder then hit “OK”, then hit “Next” on the Custom Setup page.
• Then, under Folders/Extensions, select the “…” beside “Use ARM Compiler”
• Under “Target”, select the “ARM Compiler” dropdown, and select “Use default compiler version 5”
o If you do not see these options, re-open “Options for Target …” until you do
• Hit “OK”
• Now you can build your project!
a. Take a moment to look at the Keil IDE. It opens in the Code Perspective, shown below.
b. Build the project. Select Project->Build Target (or press F7)
c. Configure the Debugger for the project. Select Project-> Options for Target ‘Target 1’
• LEARN THIS STEP. You will have to do it every time you create a new project!
• Select the Debug Tab
• The Debug Tab has two columns where you have to choose one or the other.
• LEFT column: Use Simulator
• A simulator is a software program that runs your program on a software- implementation of our computer.
We will generally NOT be using the simulator but it is useful if you want to work at home. Check this box.
• RIGHT column: Use Debugger (i.e. with real hardware)
• This is the option that you will generally pick for the remainder of the term, every time your create a new
project.
• Select the CMSIS-DAP Debugger
• Click OK
7. It is finally time to connect up your Hardware: Just the Launchpad and the USB cable that will connect it
to the host machine (either the lab machine or your laptop).
• A green LED on the left side should turn on once there is power.
TIP: ALWAYS
8. Run your program
build your
- Select Debug-> Start/Stop Debug Session
project
• If you watch the Build Window closely, you will see messages and a progress bar that
before
shows the downloading of your program to the hardware.
starting a
- A new perspective is loaded, called the Debug Perspective (See Figure below)
Debug
session. This
will ensure
that you are
running the
latest version
of your code
• Some default VIEWs are shown registers for low-level debugging, Assembly translation of your C code,
your C code itself, the Call Stack showing local variables (if any)
• As time goes by, explore other VIEWs by selecting View on the top menu.
- At this point, the program is downloaded (into the hardware or the simulator). It is NOT running! You
actually have to launch the program by clicking on Project->Debug or the Run icon (See Red Circle in the
Figure below)
• If you are running on real hardware, you should see a red LED blink.
• If you are running on the simulator, sorry but you’ll see nothing, but you will have learned all the steps in
running an existing project.
- Do your first modification: the main program in the file blinkLED.c includes an infinite loop. Change it
so the LED blinks ONLY as many times as the last digit in your Student Number + 10 (i.e., if your student
number it ends in 1, blink 11 times and end; if it ends in 7, blink 17 times… etc.).
Marking Scheme: This is a short assignment and it is worth 2 marks.
You must submit the files identified below using Brightspace. The submission process will be canceled at
the deadline. No assignments will be accepted after the deadline (mark = 0). No exceptions.
Assignments will receive zero if it is late OR any of the directions are not followed (including late
submission or lack of comments).
Assignments will receive marks as per the marking scheme, if your compiles and runs correctly when run
by the TA. If your code does not compile, you will receive a mark of zero for that exercise. In each case,
the solution should demonstrate what is being asked for.
You will demonstrate the advance of your lab during lab hours. The TAs will record your activity. If you
cannot answer the TA questions, you will receive a mark of zero.
Bonus 1 (2 marks):
Refresh your C coding and do this:
- Define an array of 4 integers
- Initialize the array with the first 4 digits of your student number
- Modify the code above so that the program makes the LED blink each of the numbers in reverse order
(starting by the 4th digit), one after the other. Wait approximately 1 second between numbers (do not worry
about the precision; 0.75s or 1.25s is fine; use a wait loop to delay the outputs between numbers).
Bonus 2 (3 marks):
- Repeat the exercise above, but store your student number in a linked list.
- Show the student number traversing the linked list and using each number as LED blinks
- Now traverse the list in reverse order, and repeat (i.e., blink your student number in reverse order).
Deliverables
2) Record a video that shows the hardware kit running the “blinkLED.c” program (and the bonus parts if you
programmed them).
3) Your source code and project file in a single zip file. Add the video and the screen capture. Zip the
project in its working form. Name your project zip file like this:
Lab1Proj_<your_ID>.zip; Lab1Bonus1_<your_ID>.zip and Lab1Bonus2_<your_ID>.zip.