March Test Flashcards
(31 cards)
What did Arm design the Cortex-M series to be?
Whats the M stand for?
Low-cost and energy efficient
Microcontroller
What are the M4 and M0 designed for?
Whats special about the M0+?
M4: high performance, general use
M0: low-cost, simplicity
M0+: most energy efficient
Whats the F in M4F stand for?
Whats it good at doing? Two things
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
Why is power loss small in CMOS?
There isn’t a static current path from Vdd to Vss so static power consumption is low
What can cause power loss in CMOS?
Three things
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
4 ways to reduce power consumption in a CMOS circuit
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
What is a task?
Two types of tasks
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
Responding to event triggers: polling
Edge-triggered interrupts
What to remember about the ISR
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
Hybrid approach to event triggers
Why do this?
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
Time-triggered task: two ways to do it
Sleep modes: two types
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
5 things that make up a finite state machine
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 to define a state? (what to write inside the circle)
Name (often a number)
Output state
Wait time for how long it will be in state
Using transition tables and structs with FSM’s
Revise
I^2C: whats it stand for
How’s it work
Two types of wires, what is required with them
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
I^2C: how many pull-up resistors are needed?
How many slaves can be on the same bus in theory?
And in practise
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
I^2C: how is start and stop defined using both lines?
How is data sent
What is sent after the data
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
I^2C: what is sent on the first transaction to a slave?
The 8th bit is a read/write bit
If 0, master writes to slave
If 1, master reads from slave
Whats the bit shift operator?
Setting a bit using bit shift
Clearing a bit
>> 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 &= ~(1<<7); clears bit 7
Reading single values from sensors
What phrase to look for for reading multiple values and how it works
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
Writing values to a sensor: what 3 bytes need to be sent
Which type of register are you writing to?
Slave write address
Register address
Value to store in register
Configuration register
Creating an I^2C object
Setting the frequency
I2C name(I2C_SDA, I2C_SCL); name.frequency(40000);
C++ code rough: send a single byte to a register
Read a single byte
How to read multiple bits
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)
MBED error: where is the error message printed, what happens
Prints to stderr (USB serial ports), flashs LED’s
FXOS8700CQ: what two things make it up and how many axis can they use
What is the overall package made from?
Accelerometer and compass
3 axis
NXP Semiconductors