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.).
writing a 1 causes INIT to be raised and the sonar unit to wait for an echo allows sonar unit to interrupt processor if set to one when echo returns this bit goes high and an interrupt (if enabled) is signalled a one written here clears the interrupt bit distance in meters from the time the start bit is written to detecting echo |
![]()
|
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.
|
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.
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 Messages
Pilot -> Server Messages
|
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.
We don't need to worry about interrupted HELLO packets since they are
constantly retransmitted. A timeout mechanism will discover if GET packets
were blocked. A corrupted GET packet will simply be ignored, causing the
Pilot to timeout and retransmit. READ packets that are interrupted will
simply cause a header to be resent that didn't need to be. Corrupted
RECV packets are identified by a checksum. If the entire RECV packet is
blocked, the Pilot will assume that the GET message failed to arrive and
retransmit the request.
|
c) Is there any reason to limit packet size?
You might want to limit packet size to reduce the cost of error handling.
For example, if the data portion of RECV packets were split into smaller
packets, then only those packets which were corrupted would need to be
retransmitted (as opposed to retransmitting the entire message).
|
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.
Each time around the event loop, the Pilot will:
|