ECE2049 Homework #5 – Alphabet soup! USCI, SPI, ACCEL, WDT

ECE2049 Homework #5 – Alphabet soup!
USCI, SPI, ACCEL, WDT, & LPM's
(Due Monday 10/13/14 At the BEGINNING of class)
PLEASE (NEATLY) SHOW ALL WORK! Comment all code well. Do not make the
grader guess what your doing! All code should be typed.
To ensure proper grading & return, please attach the included cover sheet!
Refererence: MSP430 User's Guide Ch. 34, 35, class notes, examples, Davies10.1-5,
12-13, 6.10, & 8.1, CMA3000 Users Guide and the MSP-EXP430F5529 User's Guide
1) Answer the following questions completely. (10 pts)
a) Explain the difference between a parallel interface (or parallel bus) and a serial
interface (or serial bus).
b) Explain one advantage and one disadvantage of parallel interfaces between a CPU and
its peripherals.
c) Explain one advantage and one disadvantage of serial interfaces between a CPU
and its peripherals.
d) The biggest difference between a synchronous serial interface, like SPI, and a nonsynchronous (asynchronous) serial interface is
i) Shared ground allowing higher data rate for asynchronous interfaces
ii) Shared clock allowing much higher data rates for SPI
iii) SPI can also send data in parallel at a much higher rate
iv) No real difference. All serial interfaces are about the same
e) True or False: Data sent over an SPI interface is usually sent Most Significant Bit first
while data sent via asynchronous serial interface like RS-232 is usually sent Least
Significant Bit first.
2) Refer to the CMA3000 Users Guide and HAL_Cma3000.c to answer the questions
below. (30 pts)
a) If the accelerometer is rotated 60o anti-clockwise about its Y axis, what would the
output values for each axis be? What if it were rotated 60o clockwise about its Y
axis? (Remember your physics!!). Assume the +/-2 g range.
60o
-60o
b) What force is along each axis if the readings from the CMA3000 are
X= 0x00, Y= 0x27, Z =0x28. What is the orientation? Assume +/-2 g range.
c) Modify Cma3000_init() to configure the CMA3000 to use its +/- 2 g range but in
the 40Hz, 10 Hz mode.
d) Assume the CMA3000 has been set to its +/- 8 g range (400 Hz mode), repeat question
(a)
e) Assume the CMA3000 has been set to its +/- 8 g range (400 Hz mode), repeat question
(b)
3) The Analog Devices ADT7310 is an SPI capable Thermal Sensor. Read the data sheet
for the ADT7310 then using HAL_Cma3000.c and the class notes on the MCP4921 as a
guide, design an interface between this device and our MSP430F5529. Use USCI A1 and
what ever port pins you need that are available to you on the J4 and/or J5 headers on the
MSP-EXP430F5529 board. See the board Experimenter Board User's Guide for the
jumper pin outs. (30 pts)
a) Draw an interface block diagram for the ADT7310 like the ones shown in class
notes for the accelerometer showing how all its pins are connected. What are
your supply voltages? How did you implement your CS?
b) Write a getTemp() function modeled after the Cma3000_readRegister()
function.
c) Write a program that takes a temperature reading from the ADT7310 once per
second using TimerA2 to measure time.
4) Refer to Davies 8.1 and the MSP430F55xx User's Guide Ch 16 to completely answer
the following questions (10 pts)
a. Explain the general purpose of a Watch Dog Timer in an embedded system?
b. Why is it important to either configure or stop the WDT on an MSP430 at the very
beginning of main()?
c. On the MSP430F5529, what interval is the WDT counting by default?
d. This program is intentionally using the WDT and the programmer believes he is
properly “feeding the dog”. However, the code sometimes still seems to randomly
reboot but not all the time. What specific line(s) or segments of code do you think
could be causing the problem for the WDT configuration as shown below. Explain
why. (Hint: WDT Configuration is valid.)
Assume that the MSP430F5529's clocks are running at their default frequencies.
// what interval is the WDT counting?
#define WDTCONFIG (WDTCNTCL|WDTSSEL_1|WDTIS_5);
void main(void)
{
char
key;
WDTCTL = WDTPW | WDTCONFIG;
init_sys();
// initialize system and peripherals
while (1)
{
WDTCTL = WDTPW | WDTCONFIG; // feed the dog
checkButtons();
// Check cap touch keys
keypressed = (struct Element *)TI_CAPT_Buttons(&keypad);
if (button1)
redLEDon();
while (keypressed == 4)
{
// Intro Screen -- Write to the display screen
GrClearDisplay(&g_sContext);
GrStringDrawCentered(&g_sContext, "Welecome to",
AUTO_STRING_LENGTH, 51, 16, TRANSPARENT_TEXT);
GrStringDrawCentered(&g_sContext, "ECE2049",
AUTO_STRING_LENGTH, 51, 32, TRANSPARENT_TEXT);
GrStringDrawCentered(&g_sContext, "A-term 2014",
AUTO_STRING_LENGTH, 51, 48, TRANSPARENT_TEXT);
}
if (keypressed>0)
{
ledOn(keypressed);
swDelay(1);
ledOff(keypressed);
}
// light LED
// turn off
}
5) Read Davies 6.10, the MSP430F55xx User's Guide 1.4 and the MSP430F5529 data
sheet (pg 20 & 53) before answering the following questions. (10 pt)
a) List the Operating Modes of of the MSP430F5529.
b) Explain the characteristics of each mode in terms of power consumption & time to
return to the active state.
c) Describe how a C program enters and exits each mode (i.e. what constraints are
there on waking, required clocks, etc.) or whether a Reset is required.
d) Explain how entering an Interrupt Service Routine terminate low power mode?
6) An MSP430F5529 is being used in a certain application where it is in Active Mode
10.5% of the time, in LPM0 19.5% of the time and in LPM4 the rest of the time (assume
Vcc = 3.0V). This application must run for a minimum of 5 years. What must the
capacity (in mA-hrs) of the battery that powers the system be in order to achieve this?
(10 pts)
ECE2049 Homework #5
Submitted by:__________________________________
ECE Box #:____________
Date:_______________________________
Question
1 -- 10
2 -- 30
3 -- 30
4 -- 10
5 -- 10
6 -- 10
Total:
Grade