Form a team and register your time slots before 6.10
Lab Exercise¶
Learning Objectives: In this exercise, you will become familiar with programming the SensorTag in the IDE development environment. The exercise also teaches how to create tasks and communicate with various devices using the SensorTag.
After the exercise, you will be able to create programs for SensorTag using the CCS IDE, debug these programs, load and run them on the device, and use different peripheral components/devices of the SensorTag:
- Use buttons and LEDs with the
PIN
library. - Read data from a sensor using the
i2c
protocol. - Implement a simple state machine to synchronize sensor data reading and transmission.
- Communicate with simple messages in the development environment's Debug window using the
UART
library.
Implementation
The lab exercise is divided into two sessions. You can attend any of the proposed times for both sessions. Attendance is mandatory, and all team members must attend at the same time.
Below is the schedule for the different session times:
Time | Location | Session |
Mon 07.10. 10-12 | TS135 | Session 1 |
Mon 07.10. 12-14 | TS135 | Session 1 |
Tue 08.10. 12-14 | TS135 | Session 1 |
Tue 08.10. 14-16 | TS135 | Session 1 |
Wed 09.10. 12-14 | TS135 | Session 1 |
Wed 09.10. 14-16 | TS135 | Session 1 |
Thu 10.10. 10-12 | TS135 | Session 1 |
Thu 10.10. 12-14 | TS135 | Session 1 |
Mon 14.10. 10-12 | TS135 | Session 2 |
Mon 14.10. 12-14 | TS135 | Session 2 |
Tue 15.10. 12-14 | TS135 | Session 2 |
Tue 15.10. 14-16 | TS135 | Session 2 |
Wed 16.10. 12-14 | TS135 | Session 2 |
Wed 16.10. 14-16 | TS135 | Session 2 |
Thu 17.10. 10-12 | TS135 | Session 2 |
Thu 17.10. 12-14 | TS135 | Session 2 |
Preparations¶
Before 6.10, you must form a team and register for different time slots.
Before starting the exercise, the C language programming exercises should be completed. The exercise largely involves copy & paste from lecture materials and your own C language exercises.
Step 0: Create a group and book your time.¶
Step 1: Review the lecture material¶
The lab exercise is designed for learning device programming, so students should have an understanding of C language before starting the exercise.
To ensure smooth progress, it is recommended to go through the following lecture chapters independently before the exercise:
- Lecture Chapter 14: Implementing a SensorTag Program
- How to implement program functionalities as tasks?
- Lecture Chapter 15: Input / Output
- How to initialize and use buttons and LEDs in the program?
- Lecture Chapter 16: Interrupts
- How to write an interrupt handler for a pin?
- Lecture Chapter 17: Serial Communication
- How to use the UART library
- How to compose an i2c message, and how to send and receive it?
- Lecture Chapter 19: State Machines
- How to use a state variable between tasks?
- Lecture Chapter 20: SensorTag Peripherals
- How to interpret sensor data from registers?
Step 2 - Installing the Development Environment¶
All required development environment is installed in a virtual machine, and it is accessible through all university computers. This is the option recommended by the course staff. You can also install the development environment on your own computer. In this case, the SensorTag development environment can be set up in two ways:
- All the required software is pre-installed on a virtual machine. This also requires installing a virtual machine runtime environment. It is compatible with both Windows and Linux (not Mac). This is the option recommended by the course staff.
- CCS IDE, on the other hand, offers more features as a full-fledged embedded development environment on your workstation but requires a larger installation and more processing power. It is compatible with Windows / MacOS / Linux. Course staff wont offer support for installation.
For Linux distributions, Ubuntu-based distributions are recommended, as they are supported by TI. The virtual machines, for example, are built on Linux Lite. In previous years, installing and using the software on other Linux distributions has been difficult.
Option 1: Virtual Machine¶
The recommended option is to bring the course’s virtual machine to your own computer. The virtual machine comes with CCS IDE pre-installed.
The package size is 12GB, so downloading it will take some time. When copied from the workstation, the virtual machine fits on a 16GB USB stick / Google Drive, etc.
NOTE for MAC users with M1 and M2 chips: Unfortunately, VirtualBox is not supported on this platform, so you cannot use your computer for SensorTag programming.
The virtual machine image file can be downloaded here.
For instructions on installing and setting up the VirtualBox environment, you can check the instructions here.
Option 2: CCStudio IDE¶
These instructions will help you install the CCS IDE development environment intended for workstations on your own machine.
Download links in this order:
Make sure TI-RTOS and XDC Tools are installed on your computer. In CCS, go to Windows > Preferences > Code Composer Studio > Products. If they are not installed, install them.
For Linux (=Ubuntu) and Mac, the installation is mostly the same.
- General instructions here.
- Supported operating system versions can be found on the above site.
- For Linux distributions, you should use Ubuntu / Ubuntu-based distributions, as TI officially supports it. Some students have tried using other distributions, but this has often resulted in a frustrating installation battle. In the course’s virtual machine, the IDE is installed on an Ubuntu-based Linux Lite distribution.
Make sure TI-RTOS and XDC Tools are installed on your computer. In CCS, go to Windows > Preferences > Code Composer Studio > Products. If they are not installed, install them.
NOTE for MAC users with M1 and M2 chips: Unfortunately, the version of TI-RTOS we are using in the course is not supported on this platform, so you cannot use your computer for SensorTag programming.
The empty project example is no longer available through TI Resource Explorer. It must be downloaded here. Please note that the same project can also be found in the course GitHub exercises. In CCS Studio, open Project > Import CCS Project and select the .zip file.
Potential issues during installation:
- The same debugger firmware update issue
- CCStudio cannot handle spaces in file paths. Therefore, it is preferable to install all programs in the default directory
C:\ti
- When compiling code for the device for the first time, a request to update the debugger firmware may appear. Start the update and wait for it to finish. Various error messages (yellow and red text) may appear in the debug window during the update process, but you can ignore these. Once the update is complete, you may need to power cycle the device (i.e., disconnect it from the USB cable) and press Retry multiple times until the connection is established.
- The IDE cannot find the correct version of RTOS or XDCTools, which manifests as a long list of error messages during the build phase, eventually stating that the wrong version of XDCTools is being used. Please, be sure that you use the right XDCTools. Teemu explained this in a -- WARNING: BROKEN LINK --video.
- Linux distributions should use Ubuntu / Ubuntu-based distributions, as TI officially supports it. Some students have tried using other distributions, but the frustrating installation battle is not worth it.
In Conclusion¶
If any other issues arise during installation, please contact the course staff as soon as possible.
Give feedback on this content
Comments about this material