eecs 473 midterm exam · 3. one ble uart friend. this device will send bluetooth messages back to...
TRANSCRIPT
Page 1 of 14
EECS 473 Midterm Exam
Fall 2018
Name: ____________________________________ unique name: _____________
Sign the honor code:
I have neither given nor received aid on this exam nor observed anyone else doing so.
___________________________________
NOTES: 1. Closed book and Closed notes 2. There are 14 pages total for the exam as well as a handout which you will need for the last question. 3. Calculators are allowed, but no PDAs, Portables, Cell phones, etc. Using a calculator to store notes is
not allowed nor is a calculator with any type of wireless capability. 4. You have about 120 minutes for the exam. Be sure to show work and explain what you’ve done when asked to do so. That may be very
significant in the grading of this exam.
Page 2 of 14
1. Circle the letter in front of all the true statements.
[10 points, -1.5 per wrong circle/lack of a circle, minimum 0]
a) A major advantage of alkaline batteries over lithium-polymer batteries is that alkaline
batteries have a lower self-discharge rate.
b) The command “mknod bob 2 4” creates a character device file named “/dev/bob”
c) Ceramic capacitors tend to have a lower ESR than tantalum capacitors.
d) The PCB power/ground plane has a relatively large capacitive value, but has significant ESR,
when compared to a ceramic capacitor.
e) In a task with a “firm” deadline the results have no use after one the deadline has passed.
f) “Busybox” is a single Linux binary that can emulate a number of other binaries. This is
done, in part, for the purpose of keeping the Linux image small.
g) A “via” on a board is a connection between two devices on a middle layer (not the top or
bottom).
h) The changes in GPLv3 from GPLv2 were in part as a response to hardware designs that
made it very difficult to run modified code.
i) If you license something under the MIT license, others can only use your work for non-
commercial purposes unless they get explicit permission from you.
j) Most PCB fab houses today require a clearance of at least 20 mills between traces.
k) EMI concerns are largely about preventing the generation of high-speed signals on the
power and ground lines.
l) Wider traces have lower resistance than narrower ones (all else being equal).
m) Shorter traces have lower resistance than longer ones (all else being equal).
n) Inductors resist changes in current.
Page 3 of 14
2. Consider the following code found as the read function member of the file_operations struct for a Linux kernel module. It is associated with the device file "/dev/txx2" (so a read of the file /dev/txx2 will result in this function being called). Assume that everything is set up appropriately beforehand. Ignore the fact that copy_to_user’s return value is being ignored (it’s just a warning…). [8 points] const char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ssize_t memory_read(struct file *filp, char *buf,
size_t count, loff_t *f_pos) {
/* Transferring data to user space */
copy_to_user (buf, s+*f_pos, 3);
/* Changing reading position as best suits */
*f_pos+=2;
if(*f_pos>=8)
return 0;
printk("<1> fpos= %d\n",*f_pos);
return 3;
}
Say that someone does a cat of /dev/txx2. a) What will appear in the log file? [3]
b) What will be printed by the cat command? [5]
Page 4 of 14
3. Consider an embedded application which consists of 4 tasks named A, B, and C. Each task is
CPU bound (that is, there is no I/O or memory operations which take significant time to
execute) and periodic. Each task must complete before the next instance of the task is ready
to start. These tasks have the following properties and requirements. You are to assume
there is no overhead of any type (including scheduling overhead) and that this machine
runs any given instruction in exactly the same amount of time. [13 points]
Task Maximum number instructions
executed by a single instance of the task
How often the task needs to
run A 5 Million 50ms B 15 Million 200ms C 6 Million 250ms
a) Which task do you give the highest priority under RM scheduling? The lowest? [2]
Highest ___________
Lowest ___________
b) You are choosing between 4 different processors. Which of these would be the lowest
MIPS processor which would be able to schedule these tasks using EDF? You must
clearly explain your work to get any credit. [4]
150 MIPS 200 MIPS 250 MIPS 300 MIPS
c) You are choosing between 4 different processors. Which of these would be the lowest
MIPS processor which would be able to RM schedule these tasks? You must clearly
explain your work to get any credit. [7]
150 MIPS 200 MIPS 250 MIPS 300 MIPS
Page 5 of 14
4. Decoupling capacitors [6 points]
The above graph shows the frequency vs. impedance for a given capacitor. Redraw the
graph showing the same information we instead put used 10 new capacitors (in parallel)
which each had the same ESR and ESL but only 1/10th the capacitance.
5. Say you have a linear regulator with an 9V input, a 3.3V output and a quiescent current of
10mA. If the load being driven by the regulator is a constant 100 Ohms, how much power is
wasted by the regulator? Show your work. [5 points]
Page 6 of 14
6. Consider a battery with the above discharge characteristics that has a 3000mAh capacity.
Say your application requires 2A with at least 1.7V. [6 points]
a) For about how long would a single battery of this type run your application? [2]
b) If your application used 10 of these batteries in parallel, about how long could your
application run? Briefly justify your answer. [4]
Page 7 of 14
7. Short answer. Answer each question in no more than 20 words. [7 points]
a) What is “jitter” with respect to interrupts? How can jitter occur? [2]
b) In passing an engineer mentions that “at least as the battery gets older, we’ll have less heat
on the LDO”. Explain what he likely means by that. [3]
c) During an interview an engineer shows
you this figure and asks why the top
figure is labeled as “wrong”. What do
you tell her? [2]
Page 8 of 14
Making Some Dough [45 Points]
Starting in the Winter 2019, the Department of Bread Studies (DoBS) in the College of Engineering needs
a sensor node for temperature and humidity sensing for a new climate controlled facility for storing
bread dough. The node will be one of many in the facility, and will communicate by Bluetooth to a
Raspberry Pi that will control temperature in the facility. The temperature range in this facility will
always be between 5-65 degrees Celsius
The department has asked that you make a prototype of the device. This means assembling the
hardware as well as writing the associated firmware. The device has the following components:
1. One Si7021-A20 Temperature and Humidity
sensor. This device communicates using I2C.
2. One Arduino Uno Board, powered by a 9V
battery.
3. One BLE UART Friend. This device will send
Bluetooth messages back to the Raspberry Pi.
The specification for this device is not provided,
however the interface is identical to writing to
the Serial port (to send data over Bluetooth, you
write to Serial, to get data over serial, you read).
4. A LD1117AV33 3.3V LDO.
5. One LED, that should be powered using 3.3V with a 330 Ohm resistor in series.
6. Any passives that you may require.
The Arduino has one I2C Bus (A4 is SCL, A5 is SDA). Once the Arduino is initialized, every 10 seconds it
should do the following:
● Take a temperature reading
● Take a humidity reading
● Send a message containing the following data information, in this order:
○ The first half of the Serial ID (hint: see 0xFA, 0x0F)
○ The temperature in degrees Celsius, rounded down to the nearest integer.
○ The percent relative humidity, rounded down to the nearest percent.
● If the average of Relative Humidity across readings made in the past 3 minutes is below 20%,
you should turn on your LED.
For this question you may assume the setup() has been done for you. You may assume the following.
● The RES[1:0] field of the control register has been initialized to 2b’00.
● The HTRE bit is set to zero.
● The Serial and Wire interfaces have been initialized correctly.
Figure 1. Si7021-A20 Package
Page 9 of 14
For the firmware portion of this question, you may wish to have certain global variables initialized to
certain variables. To denote the initialized value, do the following:
● int global_var = 1; //this value is initialized to one
● char buffer[2]; //in a comment, mention what this buffer is initialized to.
//example: init value zero for all members of array.
a) Answer the following questions: [8 points]
i. How many bytes do you need for the message you’re sending over Bluetooth? Justify your
answer. [3]
ii. For what temperature range(s) is the Si7021-A20 most accurate? [2]
iii. What is the I2C address of the Si7021-A20? How many different Si7021-A20s can be
addressed on a single I2C bus without using any additional GPIO pins? Briefly explain your
answer to the second question. [3]
Page 10 of 14
b) Draw the circuit diagram to showing connections that you are required to make. You may use nets
(same names are assumed connected). Include passive components as needed, and clearly label
them with their value. Note: due to other devices using current from the Arduino, you may not
power the Si7021-A20 from the Arduino. [10 points]
These pins are reserved for Bluetooth! Someone else will hook this up
LD1117AV33 LDO
Page 11 of 14
c) Implement a function that converts the value read from the temperature register to degrees Celsius.
[4 points]
int8_t registerToDegrees(uint16_t RR) {
}
d) Implement a function that converts the relative humidity reading to percent relative humidity.
[4 points]
uint8_t registerToRH(uint16_t RR) {
}
Page 12 of 14
e) Write a function that returns the first half of the serial ID. [7 points]
uint32_t getElectronicID() {
}
Page 13 of 14
f) Implement the loop() function for this system, As a reminder, here is the system spec: [12 points]
The Arduino has one I2C Bus (A4 is SCL, A5 is SDA). Once the Arduino is initialized, every 10 seconds
it should do the following:
● Take a temperature reading
● Take a humidity reading
● Send a message containing the following data information, in this order:
○ The first half of the Serial ID (hint: see 0xFA, 0x0F)
○ The temperature in degrees Celsius, rounded down to the nearest integer.
○ The percent relative humidity, rounded down to the nearest percent.
● If the average of Relative Humidity across readings made in the past 3 minutes is below
20%, you should turn on your LED.
//Globals and #defines go here
void loop() {
Page 14 of 14
}
Helper functions: If you use any helper functions, implement them here.