Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

SYS/BIOS Training Lab: Tilt App

From Texas Instruments Wiki
Jump to: navigation, search

This lab is designed to introduce users to some of the concepts of using the SYS/BIOS RTOS.

Overview

There are two sets of projects available for download from this page: tilt1 and tilt2. Each project set has an incomplete project for users to add code per the lab's instructions, and a completed solution project in which all of the code has already been added. To get the most out of using this material, we suggest you start with the incomplete project and attempt to walk through the exercise yourself, using the completed solution project to check your work at the end.

These labs are designed to work on the MSP430 using:

  • MSP430F5438A device
  • MSP-EXP430F5438 Experimenter Board
  • Code Composer Studio v4.x
  • MSP-FET430UIF emulator

Tilt1 Lab

Goals

  1. Inspect and build the first phase of an app that detects and alarms upon tilting the board.
  2. Create and configure a Hwi for low-power de-bounce of a button press.

Tasks

  1. Inspect, build and run the tilt1 example project
  2. Note the unreliable LED toggling when pressing switches S1 or S2
  3. Use XGCONF to create a Hwi
    • intNum = 58
    • hwiFxn = debounceTimerISR
  4. Enable the interval timer startup code in switchISR()
  5. Build and run; verify steady toggling of the LED as buttons are pressed
  6. Inspect SYS/BIOS state using ROV

Questions

  1. How many Hwis are used?
  2. What LPM mode is used while waiting for interrupts?

Download

Tilt1 Lab

Tilt1 Lab Solution

Tilt2 Lab

Goals

Complete the tilt application, adding: a periodic Timer that initiates ADC sampling of the accelerometer, tilt detection in the ADC ISR, and posting of a Swi when tilt is detected.

Tasks

  1. Open and inspect the tilt2 example project
  2. Create a periodic timer to call startReadADC() every 200msec
    • name = sampleTimer
    • tickFxn = startReadADC
    • startMode = StartMode_USER
    • period = 200000
  3. Add call “Timer_start(sampleTimer);” on first button press, to start calibration & sampling
  4. Enable the tilt detection logic in adcISR()
  5. Create an alarm Swi, to be run when tilt is detected
    • name = alarmSwi
    • fxn = alarmFxn
  6. Write a function alarmFxn() that calls turnOnLED()
  7. In adcISR(), replace the call to turnOnLED() with a call to a function signalTilt()
  8. Write a function signalTilt() that does a “Swi_post(alarmSwi);”
  9. Build and test

Questions

  1. How many Hwis are used in the app? How many Swis?
  2. Do Swi priorities matter much for this app?
  3. What would this app look like without using SYS/BIOS?

Download

Tilt2 Lab

Tilt2 Lab Solution