Interrupt Handling Flashcards

1
Q

What are the two method of monitoring GPIO

A

Programmed I/O with polling (a tight while loop)
Interrupt-driven I/O

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does ISR stand for

A

Interrupt Service Routine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What needs to be done before an ISR can execute

A

The interrupted process state must be saved

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When an interrupt has arrived and the state has been saved, what happens

A

A value from the interrupt vector table is loaded into the program counter and control is handed to software

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does it mean for code to be re-entrant

A

It means that a given function x can be interrupted by an ISR which calls the same function x again, and then when this ISR completes we can resume the original execution of the function x. This requires that reentrant code does not hold state, in forms such as static variables, between executions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the two important rules when writing an ISR

A

Keep them fast and keep them simple

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can we keep an ISR fast

A

Avoid loops
Avoid “heavy” instructions such as printf()
Don’t block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why do we not need ISRs to be re-entrant

A

Because they should be fast, and they are both faster and simpler if they are not re-entrant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the latency of an interrupt describe

A

The latency of an interrupt describes the time between an interrupt being received and the CPU being able to respond

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is jitter

A

Jitter is the name given to the variation in latency which is a result of the current instruction position

The interrupt could arrive at the start or the end of a clock cycle for instance, or arrive in the middle of a multi-cycle instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are some ways we can write an ISR which makes it fast and simple

A

Move any data which needs processing to a buffer so it can be processed outside the ISR
Set a global flag we can check in the main program, and then return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When making use of global variables in a ISR, what attribute must the variables have and why

A

They must have the volatile attribute such that their value isn’t cached or optimised

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What types of events can trigger interrupts, give some examples

A

Internal events such as timer overflow or the completion of ADC conversion

External events such as a button press

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are events such as a Pin Change to High associated with and where

A

These events are associated with an Interrupt Service routine through the Interrupt Vector Table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the use of a relocatable vector table

A

A relocatable vector table is a feature of some Processors where a register stores a pointer to the vector table, this means that we can store state and how we handle interrupts as a result by simply changing this pointer (And as a result the vector table we are using)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A