CSE 477 Midterm Exam (3 Nov 1999)

Name:  _______________________________    ID#: ________________________________


1. Microcontrollers and their I/O Devices (25 points)

Describe how you would design a new peripheral for the SA-1100 microcontroller that would directly handle the interface to a sonar module like the one you used in laboratory assignments 2 and 3.  The peripheral will be memory-mapped to the microcontroller's memory space and will have two external pins to connect it to the sonar module (INIT and ECHO).

a) What registers will provide the interface between the microcontroller and the sonar?  Describe the purpose of each in detail and include the minimum width of each register (i.e., 32-bit word, 1 bit, etc.).

b) What will be the internal components of such a device controller and how are they interconnected?  Draw a block diagram of the main components (i.e., registers, counters/timers, comparators, etc.) and their interconnection and explain their operation for a basic scenario of generating a pulse and determining the time until an echo is detected.  You should
have the microcontroller registers on one side and the microcontroller pins on the other with the components required in between.


2. Communication and Interfacing (35 points)
 
Your microcontroller needs to communicate with an I2C-compatible device but does not have built-in I2C support and there is no room to add an external I2C interface controller chip. Your only alternative is to emulate the protocol in software and use the I/O ports of your microcontroller to connect to the two I2C signal lines. Because your microcontroller does not have open-collector output pins, you will have to use two open-collector non-inverting buffers to make the electrical connection to the bus (the lines SDA and SCL) as shown in the figure below.

 

Sketch a routine (in pseudo-code) that sends out an 8 bit character over the I2C lines. You can assume that your microcontroller is the only possible initiator on the bus so that you do not need to consider arbitration. However, you must consider the effects of a slow receiving device on the SCL line. The figures below provide a reminder of the signalling convention used by the I2C bus. Make sure to consider a complete transmission including start bit, 8 bits of data, acknowledgement from the receiver, and stop bit.
 
 

Here is the beginning of a solution so that you can get an idea of the level of detail I want to see (continue from where this leaves off):
  1. raise SDA (ensure not driving SDA low)
  2. raise SCL (ensure not driving SCL low)
  3. wait until both SCL ==1 and SDA==1 for minimum time (make sure no one else using channel)
  4. lower SDA (signal the start of a byte transmission)
  5.  
  6.  
  7.  

3. Pilot Programming (40 points)
 
You are to design a wireless messaging system for the Palm Pilot. The Pilot application will continuously poll its IrDA port, listening for message servers. When a message server is discovered, the Pilot application should download new message headers for the appropriate user. Headers for messages that have already been read should not be sent. Subject lines from the message headers are displayed as shown in Form 1. When a user clicks on a message, the Pilot downloads the body of that message from the server and displays the contents as shown in Form 2 for the first message.
 

                                     
Form 1                                                                          Form 2
 

a) Describe the various messages and packet formats that will be used in your communication protocol. Begin by describing the messages received by the Pilot from the server and then describing those sent by the Pilot to the server.

Server -> Pilot

Pilot -> Server

b) How does your protocol handle an interrupted transmission (i.e., if an object blocks the IrDA port while sending or receiving a message)? Discuss what happens if each type of packet you listed above is either lost or corrupted.

c) Is there any reason to limit packet size?

d) What will the Pilot have to do in its event loop? Describe the operations that need to be performed each time around the loop. Consider both communication and user interface events.


Comments to: cse477-webmaster@cs.washington.edu (Last Update: )