NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
SYS/BIOS Training Lab: Tilt App
This lab is designed to introduce users to some of the concepts of using the SYS/BIOS RTOS.
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
- Inspect and build the first phase of an app that detects and alarms upon tilting the board.
- Create and configure a Hwi for low-power de-bounce of a button press.
- Inspect, build and run the tilt1 example project
- Note the unreliable LED toggling when pressing switches S1 or S2
- Use XGCONF to create a Hwi
- intNum = 58
- hwiFxn = debounceTimerISR
- Enable the interval timer startup code in switchISR()
- Build and run; verify steady toggling of the LED as buttons are pressed
- Inspect SYS/BIOS state using ROV
- How many Hwis are used?
- What LPM mode is used while waiting for interrupts?
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.
- Open and inspect the tilt2 example project
- Create a periodic timer to call startReadADC() every 200msec
- name = sampleTimer
- tickFxn = startReadADC
- startMode = StartMode_USER
- period = 200000
- Add call “Timer_start(sampleTimer);” on first button press, to start calibration & sampling
- Enable the tilt detection logic in adcISR()
- Create an alarm Swi, to be run when tilt is detected
- name = alarmSwi
- fxn = alarmFxn
- Write a function alarmFxn() that calls turnOnLED()
- In adcISR(), replace the call to turnOnLED() with a call to a function signalTilt()
- Write a function signalTilt() that does a “Swi_post(alarmSwi);”
- Build and test
- How many Hwis are used in the app? How many Swis?
- Do Swi priorities matter much for this app?
- What would this app look like without using SYS/BIOS?