March Test Flashcards

1
Q

What did Arm design the Cortex-M series to be?

Whats the M stand for?

A

Low-cost and energy efficient

Microcontroller

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

What are the M4 and M0 designed for?

Whats special about the M0+?

A

M4: high performance, general use
M0: low-cost, simplicity
M0+: most energy efficient

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

Whats the F in M4F stand for?

Whats it good at doing? Two things

A

Built-in floating-point unit (FPU)
Designed to do well with floating-point numbers
Does them in one clock cycle
Has a DSP so good at digital signal processing

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

Why is power loss small in CMOS?

A

There isn’t a static current path from Vdd to Vss so static power consumption is low

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

What can cause power loss in CMOS?

Three things

A

When output switches, it will either charge or discharge the gate capacitence

During output transition a short circuit can occur between Vdd and Vss

Leakage current while transistor is off

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

4 ways to reduce power consumption in a CMOS circuit

A

Lower frequency-however this is a a trade-off between power and performance

Lower amount of gates

Lower activity-i.e. when circuit not used it is powered down

Lower supply voltage. K46F can work down to 1.7V

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

What is a task?

Two types of tasks

A

An activity that is required to be performed-read a sensor, update a display etc
Event-triggered tasks: i.e. light an LED when a button is pressed
Time-triggered tasks: i.e. reading a sensor every 1 second

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

Responding to event triggers: polling
Edge-triggered interrupts
What to remember about the ISR

A

Repeatedly checking the status of an input

When voltage change on input is detected, the program goes from sleep to execute a interrupt service routine (ISR) then back to sleep
Keep code inside the ISR as short as possible

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

Hybrid approach to event triggers

Why do this?

A

Set a global flag variable in the ISR. When the program comes out of sleep it check the flag and then does the code
ISR can still be short

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

Time-triggered task: two ways to do it

Sleep modes: two types

A

Periodically: ticker
One-off event: timeout

Sleep: clock stopped until reset or interrupt occurs. Can be woken by internal or external interrupt
Deepsleep: can only wake up with external interrupt

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

5 things that make up a finite state machine

A
States that the system can exist in
Finite set of inputs
Finite set of outputs
State transitions (what happens when we are in a state and get a certain input)
How outputs are determined
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to define a state? (what to write inside the circle)

A

Name (often a number)
Output state
Wait time for how long it will be in state

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

Using transition tables and structs with FSM’s

A

Revise

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

I^2C: whats it stand for
How’s it work
Two types of wires, what is required with them

A

Inter-integrated circuit
MCU is master, sensors are slaves
Multiple slaves can be connected to same bus
Data (SDA), clock (SCL)
Lines are open-collector meaning that pull-up resistors are needed

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

I^2C: how many pull-up resistors are needed?
How many slaves can be on the same bus in theory?
And in practise

A

One for each line
Each slave has a 7-bit address so 127 slaves (address 0 is a general call address to all slaves)
In practise numbe of devices are limited by capacitive loading of lines

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

I^2C: how is start and stop defined using both lines?
How is data sent
What is sent after the data

A

Starts when SDA goes low while SCL is high
Stops when SDA goes high while SCL is high
Data is sent serially on SDA, one byte at a time on a clock edge (on SCL)
A acknowledgement bit

17
Q

I^2C: what is sent on the first transaction to a slave?

A

The 8th bit is a read/write bit
If 0, master writes to slave
If 1, master reads from slave

18
Q

Whats the bit shift operator?
Setting a bit using bit shift
Clearing a bit

A
>> for right, << for left
Use a mask - char mask = (1 << 2);
This will stick a 1 in bit 2
To set a bit without overwriting, use OR
a = a | (1<<2); will keep a but set bit 2 to 1
Use AND with a NOT 1
a &amp;= ~(1<<7); clears bit 7
19
Q

Reading single values from sensors

What phrase to look for for reading multiple values and how it works

A
Master: tells slave which register it wants to read using write 
-Slave acks by holding SDA low
-Master sends register address
-Slave acks again
Master sends read address
-Slave sends bits using SDA

Reading ‘burst’ of values: after getting a read request the slave can increment address

20
Q

Writing values to a sensor: what 3 bytes need to be sent

Which type of register are you writing to?

A

Slave write address
Register address
Value to store in register

Configuration register

21
Q

Creating an I^2C object

Setting the frequency

A
I2C name(I2C_SDA, I2C_SCL);
name.frequency(40000);
22
Q

C++ code rough: send a single byte to a register
Read a single byte
How to read multiple bits

A

Set an int to a sensor.write value. Returns 0 if ack received and 1 if not

Write to it and check for ack
Use a sensor.read and check for ack
Return in variable (rx)

Store in an array (function is void and array is passed by reference)

23
Q

MBED error: where is the error message printed, what happens

A

Prints to stderr (USB serial ports), flashs LED’s

24
Q

FXOS8700CQ: what two things make it up and how many axis can they use
What is the overall package made from?

A

Accelerometer and compass
3 axis
NXP Semiconductors

25
Q

FXOS8700CQ initialisation process: 5 steps

A
  1. Check if one of those is on the I^2C bus using WHO_AM_I register
  2. Stick it in standby mode by sending 0x00
  3. Set it to 200Hz sampling rate
  4. Configure it to +/- 4 g sensitivity
  5. Take it out of standby
26
Q

Public vs private in classes

A

Public: member/method can be accessed by users
Private: hidden from users

27
Q

What does a header guard prevent

A

A header being included more than once

28
Q

Number of pixels on the Nokia 5110 LCD
How many lines does SPI have and what are they called?
What does a master do if it wants to talk to slaves

A

84*48
Serial clock line (SCLK)
Master-out, slave-in (MOSI)
Master-in, slave-out (MISO)
Slave-select or slave-chip-enable (SS or SCE)
Makes the relevent SCE line low, then starts clock signal

29
Q
Whats the LCD's highest clock frequency?
LCD C++ commands for:
Initilising
Setting contrast
Clearing the screen
Printing strings and chars
A

4 MHz

lcd. init();
lcd. setContract(0.5);
lcd. clear();
lcd. printString(“Hello”,0,0);
lcd. printChar(‘X’,5,3);

30
Q
LCD C++ commands for:
Setting and clearing pixels
Check status of pixel
Drawing lines
Drawing circles
Drawing rectangles
Refresh buffer
A
lcd.setPixel(2,5,true/false);
if (lcd.getPixel(2,5) ;
lcd.drawLine(x0,y0,x1,y1,type);
lcd.draw(x,y,radius,type);
lcd.drawRect(x,y,width,height,type);
lcd.refresh();
31
Q

What issues can occur with the joystick and why?
How to fix this
What does it make more sense to do with the coordinates

A

If you point it to a corner you get a magnitude of root 2 instead of 1 despite being moved the same amount
Map all points to points inside a unit circle
Use magnitude and angle instead
Can use get direction instead