q2 select all

20
Q1 Honor Code 0 Points This exam is open book and open Internet. During the exam you are not allowed to communicate with any person. Not via phone, text, telegraph, in person or in any other way other than the 473 staff via the exam Piazza. This includes not posting things on any website (reddit, facebook, slack, slashdot, quara, whatever). You may read anything there as long as it doesn't involve another student in the class violating that rule. Given that, please sign (put your name) in the box below indicating that you have not violated that rule and are not aware of anyone else having done so. Q2 Select all 18 Points Select all of the following which are true. You must select all of the true ones and none of the false ones to receive credit. Q2.1 mknod 3 Points Say you have run the command “mknod /dev/bob 12 4” while in the directory /home. Which of the following is true? Answer Key

Upload: others

Post on 10-Feb-2022

32 views

Category:

Documents


0 download

TRANSCRIPT

Q1 Honor Code0 Points

This exam is open book and open Internet. During the exam you are

not allowed to communicate with any person. Not via phone, text,

telegraph, in person or in any other way other than the 473 staff via

the exam Piazza. This includes not posting things on any website

(reddit, facebook, slack, slashdot, quara, whatever). You may read

anything there as long as it doesn't involve another student in the

class violating that rule.

Given that, please sign (put your name) in the box below indicating

that you have not violated that rule and are not aware of anyone else

having done so.

Q2 Select all18 Points

Select all of the following which are true. You must select all of the true ones and none of the false ones to receive credit.

Q2.1 mknod3 Points

Say you have run the command “mknod /dev/bob 12 4” while in the

directory /home. Which of the following is true?

Answer Key

Q2.2 RM3 Points

Which of the following is true of Rate Monotonic (RM) scheduling?

Assume ideal tasks (tasks have no non-preemptable sections, only

processing requirements are significant; memory, I/O, and other

resource requirements are negligible; task are independent) and that

the cost of preemption is negligible.

Q2.3 Caps and PI3 Points

A file is created in the /home/dev directory named “bob”

The created file “bob” is a character device.

The file “bob” is associated with major number 12 and minor

number 4.

When in the directory that bob is in, writing the string “abc” to

bob can be expected to cause bob to become a text file with

the contents “abc”.

RM scheduling can successful schedule any set of tasks that

EDF can successfully schedule.

EDF scheduling can successful schedule any set of tasks that

RM can successfully schedule.

If you have 3 tasks with a total CPU utilization of no more than

76%, RM can always schedule those tasks successfully.

If you have 3 tasks with a total CPU utilization of no more than

95%, RM may be able to schedule those tasks successfully.

Which of the following is true of capacitors used to address power

integrity issues?

Q2.4 Busybox3 Points

Which of the following are true of the program “Busybox”

Q2.5 Battery3 Points

The capacitors with smaller capacitance also generally have

lower parasitics, and thus can help with higher frequency noise

than larger capacitors.

Even though the PCB ground/power plane is much larger in

size than most of the capacitors used, it has relatively low

capacitance, ESR and ESL.

When placing multiple capacitors across the same power and

group pins of a given device, you want to put the capacitors as

close to the pins as possible and put the larger capacitors

closer to those pins than the smaller ones.

It is a single binary executable that can act as a number of

different programs, such as ls, rm, and gzip, though sometimes

with more limited functionality than the “real” program.

When using softlinks to link to busybox, busybox can use

argv0 to figure out what program it is supposed to emulate.

One reason to use busybox is to have much of the functionality

of the most common programs while having a lower overall

memory footprint than having them all.

Which of the following is true of the battery described by the above

graph?

Q2.6 PCBs3 Points

Which of the following statements are true about PCBs and PCB

design?

A good estimate is that the battery has a capacity of about

2.8Ah

The 0.2C line is about 0.6 Amps.

You should be able to supply at least 2.75 for 20 minutes if the

drain is a constant 10A.

At 30A constant drain, this battery can be expected to run out

of power before 3 minutes have gone by (assume you need at

least 2.75V).

Q3 memory read8 Points

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…).

const char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ssize_t memory_read(struct file *filp, char *buf, size_t count, loff_t *f_pos) {

printk("<1> f_pos= %d\n",*f_pos);

/* Transferring data to user space */ copy_to_user (buf, s+*f_pos+1, 5); /* Changing reading position as best suits */

if(*f_pos>=8) return 0;

*f_pos+=3; return 4; }

A trace 1cm long and 20 mils wide will have a lower resistance

than one 2cm long and 15 mils wide.

Vias can be useful even when routing between two parts on

the same layer.

“Necking down” a trace is generally used to reduce heat

transference to the rest of the board when soldering, making it

easier to solder parts.

The “rat’s nest” generally includes a bunch of “air wires”.

Say that someone does a cat of /dev/txx2.

Q3.13 Points

What will appear in the log file?

Q3.25 Points

What will be printed by the cat command?

Q4 Decoupling capacitors6 Points

The above graph shows the frequency vs. impedance for a given

<1> f_pos= 0

<1> f_pos= 3

<1> f_pos= 6

<1> f_pos= 9

BCDEEFGHHIJK

capacitor. Redraw the graph showing the same information we

instead put used 10 new capacitors (in parallel) which each had the

same ESR and capacitance but 5 times the ESL.

decoupling.png Download

Q56 Points

Say you have a linear regulator with an 8V input and a 6V output. If

the load being driven by the regulator is using 2 Watts and the

quiescent current is 10mA, how much power is being wasted as heat

by the regulator? Show your work.

Q6 Moar Batteries8 Points

0.747 watts are burned, I_load = 1/3 A, 2V*I_load+8v*I_quis = total

power burned

Consider the battery discharge graph above.

Q6.13 Points

About what is the nominal capacity of the battery in Ah? Briefly justify your answer.

Q6.23 Points

If you are drawing the battery at about 36A, about what is the effective

capacity in Ah? Briefly justify your answer.

Q6.32 Points

0.6A*20h=12 Ah

36A*(7m/60m/h)=4.2Ah

If you have 2 of these batteries in parallel and you are drawing 52A

total, about how long will they last?

Q718 Points

Consider an embedded application which consists of 3 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.

Q7.15 Points

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.

52A/2=26A. Not on the group, but close to 24A. Figure 10-12 min

utes.

150 MIPS

200 MIPS

250 MIPS

300 MIPS

Q7.28 Points

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? (The table has been copied here for your

convenience.) You must clearly explain your work to get any credit.

Q7.35 Points

At 150 MIPS utilization is over 130%. At 200 MIPS it's about 98%.

EDF can schedule that.

150 MIPS is wrong because CPU utilization is over 100% (last probl

em).

200 MIPS

Task 1: exec time = 6/200 = 30 ms

Task 2: exec time = 14/200 = 70 ms

Task 3: exec time = 4/200 = 20 ms

It does not end up working when critical instant analysis is perform

ed. (Task B will fail to meet its deadline by 120 ms).

At 250 MIPs

Task 1: exec time = 6/250 = 24 ms

Task 2: exec time = 14/250 = 56 ms

Task 3: exec time = 4/250 = 16 ms

All tasks complete their first period.

150 MIPS

200 MIPS

250 MIPS

300 MIPS

Write the FreeRTOS task creation functions you would call to schedule

this application. The task functions take no arguments and are named

A(), B(), and C(). We are just asking you to create the tasks, not write

the rest of the main or the task functions themselves!

Q8 Design question--room capacity36 Points

The Problem

In the time of COVID-19, it is crucial that all designated safety

measures are maintained at UM and beyond. The capacity of indoor

spaces has been strictly limited, and it is crucial not to exceed these

limits. Additionally, it is important to limit the number of people walking

around the room at any time. A new system is needed that detects the

number of people present in a room, signals whether more people are

allowed to enter or the room is at capacity, and tracks whether people

are at their stations. You should read the entire question before

starting.

You have been asked to create a prototype of this system. This means

assembling the hardware as well as writing the associated firmware.

The device has the following components:

One red LED, that should be powered using 3.3V with a 330 Ohm

resistor

One green LED that should be powered using 3.3V with a 330 Ohm

resistor

One yellow LED that should be powered using 3.3V with a 330 Ohm

resistor

One Arduino Uno Board, powered by a 9 V battery

Two PIR sensors

(https://static6.arrow.com/aropdfconversion/8a3dc1f0f917e341ef9098816a87a2ca6

You may assume that the sensor will remain high the entire time

someone is in its line of sight.

xTaskCreate(Task1, "task1", 128, NULL, 3, NULL);

xTaskCreate(Task2, "task2", 128, NULL, 2, NULL);

xTaskCreate(Task3, "task3", 128, NULL, 1, NULL);

One analog MUX (https://www.analog.com/media/en/technical-

documentation/data-sheets/ADG5208F_5209F.pdf)

Eight pressure sensors. The pressure sensors are linear and the

circuitry needed for each pressure sensor is provided below. At

100lbs or more its value is 0 Ohm, at 50 lbs its value is 5k Ohm, and

at 0 lbs its value is 10k Ohm. You may assume a person sitting at a

station will weigh at least 50 lbs.

Any passives that you may require

This system will be used in a room that has a single entryway, which is

narrow enough to require single-file foot traffic.The room is allowed to

hold at most 8 people at a time. If the number of people in the room is

below this capacity, the green indicator LED should be illuminated.

Otherwise, the red indicator LED should be illuminated, signaling

newly arriving people that they may not enter the room. The room also

contains 8 lab stations, each with a single chair equipped with one of

the pressure sensors described above. If there are individuals not

seated at their stations in the room, the yellow indicator LED should be

illuminated, to warn people to return to their stations. A setup of the

room is shown below:

Assume we have a way to efficiently connect the pressure sensors to

the Arduino over these distances. The PIR sensors are set up in such a

way that only one sensor or the other will detect a person at a given

time.

As we learn more about COVID-19, our response to it and thus also

management of interior spaces, may change. As a result, we want to

be able to remotely update the room capacity through a UART line

that communicates at 38400 baud. All that will be transmitted is an

integer value for the new room capacity. Your device should only

respond to the serial input if something is present, rather than

constantly polling the Serial line. (Hint: use the RX line to trigger an

interrupt).

Q8.1 Electricals7 Points

Provide the connections between the Arduino, the LEDs, PIR sensors,

the pressure sensors, the analog MUX, and the battery. You should

also provide power and GND. You only need to add one pressure

sensor hookup (so you do not need to show the wiring for all 8). Just

state where they will be connected to the rest of the circuit. Add

resistors and capacitors as needed. You may use labels to make

connections. You may assume that the wireless communication

module is already attached to the Serial pins.

Q8.2 check_lab_stations()8 Points

Write the function called check_lab_stations that returns how many

people are sitting at all eight lab stations in the room.

int check_lab_stations() {

}

Q8.36 Points

Write your implementation for the capacity_ISR() that gets the updated

room capacity from the UART lines and changes the LED states if

appropriate.

void capacity_ISR() {

int num_sitting = 0;

for (int i = 0; i < 8; ++i)

{

digitalWrite(A0, (i >> 2) & 0x1);

digitalWrite(A1, (i >> 1) & 0x1);

digitalWrite(A2, i & 0x1);

digitalWrite(ENABLE, HIGH); // alternatively leave pulled h

igh

if (analogRead(PRESS_DATA) > THRESHOLD)

{

++num_sitting;

}

digitalWrite(ENABLE, LOW);

}

return num_sitting;

}

Q8.415 Points

Write the loop and setup functions that will initialize any sensors,

inputs and outputs, detect people entering and exiting the room, and

set the LEDs according to the current number of people in the room.

Define any variables or helper functions you may need. We've

provided some potentially useful definitions.

#define LED_YELLOW = 10 #define LED_GREEN = 9 #define LED_RED = 8 #define SENS_ENTER = 0 #define SENS_EXIT = 1 #define INTERRUPT = 2

#define ENABLE = 7 #define A0 = 13 #define A1 = 12 #define A2 = 11 #define PRESS_DATA = 2

// avoid other RX data re-triggering interrupt

detachInterrupt(digitalPinToInterrupt(INTERRUPT));

while (Serial.available() < 4) { }

int newCap = Serial.read();

for (int i = 0; i < 3; ++i)

{

newCap <<= 8;

newCap |= Serial.read();

}

// check for read error

room_cap = newCap;

updateRoom();

attachInterrupt(digitalPinToInterrupt(INTERRUPT), capacity_ISR, RI

SING);

#define THRESHOLD 512 // 2.5 V or above from analogRead

int room_cap = 8;

int num_people = 0

bool entered = false;

bool exited = false;

void updateRoom()

{

if (num_people >= room_cap)

{

digitalWrite(LED_GREEN, LOW);

digitalWrite(LED_RED, HIGH);

}

else

{

digitalWrite(LED_GREEN, HIGH);

digitalWrite(LED_RED, LOW);

}

}

void setup() {

Serial.begin(38400);

delay(35000); // wait for signal on PIR sensors to become sta

ble to avoid a false reading

attachInterrupt(digitalPinToInterrupt(INTERRUPT), capacity_IS

R, RISING);

pinMode(LEW_YELLOW, OUTPUT);

pinMode(LED_GREEN, OUTPUT);

pinMode(LED_RED, OUTPUT);

pinMode(A0, OUTPUT);

pinMode(A1, OUTPUT);

pinMode(A2, OUTPUT);

digitalWrite(LED_GREEN, LOW);

digitalWrite(LED_RED, LOW);

digitalWrite(A0, LOW);

digitalWrite(A1, LOW);

digitalWrite(A2, LOW);

}

void loop () {

// min sensing threshold is 1.9V -> 387 from analogRead

int enter_val = analogRead(SENS_ENTER);

// someone detected by SENS_ENTER for first time

if (enter_val >= 387 && exited == false && entered == false)

{

++num_people;

updateRoom();

entered = true;

}

else if (enter_val < 387)

{

entered = false;

}

int exit_val = analogRead(SENS_EXIT)

if (exit_val >= 387 && exited== false && entered == false)

{

--num_people;

updateRoom();

exited = true;

}

else if (exit_val < 387)

{

exited = false;

}

int num_sitting = check_lab_stations();

if (num_sitting < num_people)

digitalWrite(LED_YELLOW, HIGH);

else

digitalWrite(LED_YELLOW, LOW);

}

UNGRADEDMidterm6 DAYS, 13 HOURS LATE

STUDENT

Unknown Student (removed from roster?)

TOTAL POINTS

- / 100 pts

QUESTION 1

Honor Code 0 pts

QUESTION 2

Select all 18 pts

2.1 mknod 3 pts

2.2 RM 3 pts

2.3 Caps and PI 3 pts

2.4 Busybox 3 pts

2.5 Battery 3 pts

2.6 PCBs 3 pts

QUESTION 3

memory read 8 pts

3.1 (no title) 3 pts

3.2 (no title) 5 pts

QUESTION 4

Decoupling capacitors 6 pts

QUESTION 5

(no title) 6 pts

QUESTION 6

Moar Batteries 8 pts

6.1 (no title) 3 pts

6.2 (no title) 3 pts

6.3 (no title) 2 pts

QUESTION 7

(no title) 18 pts

7.1 (no title) 5 pts

7.2 (no title) 8 pts

7.3 (no title) 5 pts

QUESTION 8

Design question--room capacity 36 pts

8.1 Electricals 7 pts

8.2 check_lab_stations() 8 pts

8.3 (no title) 6 pts

8.4 (no title) 15 pts