C12 Embedded systems in MicroPython and C · Practice
Every topic, mixed
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Topics: all 52
Check
An LED with forward voltage 2 V hangs from a 3.3 V pin through 220 Ω. What current does it draw?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
Choose the series resistor for an LED with 2 V forward voltage to carry 2 mA from a 3.3 V pin.
Write units the way you normally would: 1.5 Ω, 1500 mΩ and 0.0015 kΩ are the same answer.
Check
How many clock cycles of the 10 MHz board pass in 25 µs?
Check
A register sits at offset 08 from a peripheral's base, 40000000. What's its address, in hex?
Check
Pin P5 is bit 5 in the GPIO registers. What mask, in hex, selects only that pin?
Check
8 LEDs each draw 3 mA from their own pins. How much current does the chip supply to them in total?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
An LED is wired to P2. Write a MicroPython program that turns it on.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
An LED with 2.1 V forward voltage is driven from a 3.3 V pin through 100 Ω; a pin may source 12 mA.
(a)
What current flows?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How many such LEDs can one pin drive?
Check
On the 10 MHz board, consider an interval of 2.5 µs and a loop of 4 one-cycle instructions.
(a)
How many cycles is the interval?
(b)
How many whole passes of the loop fit in it?
Check
LED current: 2 V LED, 150 Ω, 3.3 V pin?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
Cycles in 80 µs at 10 MHz?
Check
Mask for P7, in hex?
Check
An LED is on for 100 ms and off for 150 ms. At what frequency does it blink?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
On for 100 ms and off for 150 ms: what's the duty cycle?
Check
An LED should blink at 2 Hz with a 10% duty cycle. How long is it on in each period?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A fixed-sleep loop also spends 2 ms on work each pass. How far behind is it after 100 passes?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A loop makes 50 hardware calls (40 µs each) and then sleeps 5 ms. How long does one pass take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Blink the LED on P0: on for 200 ms, off for 100 ms, forever.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
Toggle P0 every 125 ms without drifting, even though each pass also reads P4 (a pull-up input) ten times.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
An LED blinks at 2 Hz with a 10% duty cycle.
(a)
How long is it on each cycle?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And off?
Check
A MicroPython loop makes 1 hardware call(s) of 40 µs, then sleeps 100 ms.
(a)
How long is each pass?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
After 8 hours, how far behind is a count of passes against one made with exactly 100 ms passes?
Check
Blink frequency for 20 ms on, 80 ms off?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
On-time for 4 Hz at 20% duty?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Drift after 500 passes with 1 ms of work?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A busy-wait loop takes 4 cycles per pass. About how many passes make 5 ms on the 10 MHz board?
Check
A loop toggles a pin once per pass, and each pass takes 3 cycles. What's the frequency of the square wave?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
What mask, in hex, selects pins P1 and P3 together?
Check
A GPIO register sits at offset 20 (decimal) from the GPIO base, 0x4000_0000. What address does the C header cast to a pointer, in hex?
Check
A register write takes 4 instructions in C (100 ns each) and 40 µs in MicroPython. How many times faster is C?
Check
LEDs are wired to P1 and P3 (the program can use the constants A and B). Make both pins outputs and turn both LEDs on.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
Blink P0 with HALF (10) ms on and 10 ms off, timing it with SYS_CYCLES (10 cycles per microsecond).
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
A delay loop takes 4 cycles per pass on the 10 MHz board.
(a)
How many passes make 1 ms?
(b)
How long is one pass?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
A C loop toggles a pin every 3 instructions of one cycle each.
(a)
What frequency comes out?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
(b)
How many times faster than MicroPython's 12.5 kHz is that?
Check
Passes of a 5-cycle loop in 2 ms?
Check
Toggle frequency with 6 cycles per pass?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
Mask for P1 and P6, in hex?
Check
Read the 4-bit field at bit 4 of BEEF. What value is it, in hex?
Check
A register byte holds B9. What does it hold after x &= ~(1u << 0);, in hex?
Check
A uint8_t holds 250. What does it hold after adding 60?
Check
An array of 64 elements, each 1 byte(s) wide (uint8_t, uint16_t or uint32_t): how many bytes of RAM does it use?
Check
What's the largest value a 5-bit unsigned field can hold?
Check
X is 48879. Print the 4-bit field that starts at bit S (4), then print X with that field replaced by 12 and every other bit unchanged.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
A register holds 0E97. A field of 4 bits starts at bit 4.
(a)
What is the field's value?
(b)
What does the register hold after the field is cleared?
Check
200 and 100 are added in 8-bit variables.
(a)
What does a uint8_t hold?
(b)
What does the same bit pattern mean as an int8_t?
Check
A5 after clearing bit 2, in hex?
Check
uint8_t 240 plus 20?
Check
Largest value in 8 unsigned bits?
Check
A chip has 16 KB of RAM; the program has 1 KB of .data, 6 KB of .bss and a 4 KB stack.
(a)
How much RAM is free?
(b)
What share is used?
Check
The deepest call chain is 15 frames of 32 bytes, and 2 interrupt level(s) of 64-byte frames can stack on top.
(a)
How much stack does it need?
(b)
What should be reserved with a 30% margin?
Check
A painted stack of 2048 bytes still has its lowest 300 bytes untouched after testing.
(a)
What is the high-water mark?
(b)
What share of the stack was never used?
Check
A lookup table has 256 entries of 1 bytes.
(a)
How much flash does it take if it's declared const?
(b)
How much RAM does it waste if const is forgotten?
Check
7 KB of a 12 KB RAM is used. How much is free?
Check
Stack for 10 frames of 40 bytes?
Check
High-water mark of a 2048-byte stack with 512 bytes untouched?
Check
An LED with a 2.1 V forward voltage must carry 2 mA from a 3.3 V pin.
(a)
What series resistor does it need?
Write units the way you normally would: 1.5 Ω, 1500 mΩ and 0.0015 kΩ are the same answer.
(b)
Each on its own pin, how many such LEDs fit within the 50 mA package limit?
Check
A delay must last 400 µs, built from a loop of 4 cycles per pass.
(a)
How many clock cycles is that?
(b)
About how many passes does the loop need?
Check
A peripheral starts at 40002000; a register sits at offset 4 (decimal).
(a)
What's the register's address, in hex?
(b)
Counting from 0x4000_0000 in 4 KiB blocks, which block number is the peripheral in?
Check
A program drives P2 and P5.
(a)
What mask selects both pins, in hex?
(b)
What's ~mask & 0xFFFF, the mask of every other pin, in hex?
Check
A C loop toggles a pin once per pass, 4 cycles per pass; a MicroPython loop toggles it with 2 hardware calls per pass.
(a)
What frequency does the C loop make?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
(b)
And the MicroPython loop?
Check
An LED blinks at 4 Hz with a 10% duty cycle.
(a)
How long is it on each period?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And off?
Check
A fixed-sleep loop sleeps 250 ms and makes 3 hardware calls (40 µs each) per pass.
(a)
How long is each pass?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
Compared with an exact 250 ms grid, how far behind is it after an hour of passes?
Check
A uint8_t holds 230; 90 is added to it.
(a)
What does it hold?
(b)
What would a uint16_t hold?
Check
A register holds C3F0.
(a)
What's the 4-bit field at bit 4, in hex?
(b)
What's the register after writing 9 into that field, in hex?
Check
A field is 10 bits wide.
(a)
What's the largest value it holds?
(b)
What's that value times 1?
Check
A table holds 50 values of 2 bytes each, and the board has 60 KiB of RAM.
(a)
How many bytes does it take?
(b)
What percentage of the RAM is that?
Check
A C register write takes 3 instructions; a MicroPython one takes 40 µs. A task makes 20 thousand writes.
(a)
How long does it take in C?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And in MicroPython?
Check
A chip has 16 KB of RAM. The program has 1 KB of .data and 6 KB of .bss; its deepest call chain is 20 frames of 48 bytes, plus one 64-byte interrupt frame.
(a)
How much stack does it need?
(b)
How much RAM is left over?
Check
A lookup table of 512 entries of 2 bytes is declared without const.
(a)
How much RAM does it waste?
(b)
How much memory does it occupy in all, counting its copy in flash?
Check
A recursive function puts a 64-byte buffer on the stack and recurses 8 levels deep; each frame also holds 16 bytes of saved registers.
(a)
How much stack does the recursion take?
(b)
How much if the buffer is made static?
Check
A button pulls a 10 kΩ pull-up to ground. What current flows while it's held?
Write units the way you normally would: 1.5 µA, 1500 nA and 0.0015 mA are the same answer.
Check
A 10 kΩ pull-up charges 10 pF. How long until the pin crosses (70% of the supply)?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
On a 3.3 V CMOS input, a threshold is 0.3 × the supply. What voltage is that?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
GPIO_IN reads 0011. What does (GPIO_IN >> 4) & 1 give, the level of P4?
Check
A 47 kΩ pull-up's button is held for 1 hours a day. How much charge does the pull-up draw each day?
Write units the way you normally would: 1.5 mAh, 1500 µAh and 0.0015 Ah are the same answer.
Check
A button pulls a 10 kΩ pull-up on a 3.3 V pin to ground.
(a)
What current flows while it's pressed?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How much power is wasted while it's pressed?
Check
A 47 kΩ pull-up charges 10 pF of pin and wire after a button is released; the pin reads 1 above 2.3 V.
(a)
How long until it reads 1?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
What is the time constant?
Check
Current through a pressed 22 kΩ pull-up?
Write units the way you normally would: 1.5 µA, 1500 nA and 0.0015 mA are the same answer.
Check
Rise time to 70% through 5 kΩ into 15 pF?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
P4's level when GPIO_IN is 0030?
Check
A button's contacts bounce 2 times on every press and 2 times on every release. How many falling edges does a fast program see for 3 presses?
Check
A debouncer samples every 2 ms and accepts a level after 3 equal samples in a row. About how long after the contacts settle does it react?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A hardware debouncer uses 10 kΩ and 0.1 µF. What's its time constant?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
The worst bounce measured is 5 ms. With a safety margin of 1.5×, what stable time should the debouncer require?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Someone presses a button 10 times a second. How far apart are the presses?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A debouncer samples every 2 ms and needs 3 equal samples in a row.
(a)
At most how long after the contacts settle does it react?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is the fastest press-and-release rate it can follow, needing a full count for each?
Check
A debouncer ignores the button for 50 ms after each accepted press.
(a)
At most how many presses a second can it accept?
(b)
Can it keep up with a person pressing about 7 times a second (1 for yes)?
Check
Falling edges for 2 presses bouncing 1 times each way?
Check
Reaction time, 2 samples at 4 ms?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
τ for 22 kΩ and 0.47 µF?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
An array of 2-byte elements starts at 1040. What address does element 10 read, in hex?
Check
A breakpoint sits inside a loop of 8 passes, nested in a loop of 4 passes. How many times does it stop the program?
Check
A program prints 20 characters over a UART at 9600 baud, waiting for each. How long does it take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A loop meant to average 8 samples, each 512, runs one pass too many and adds the next value in memory, 60000, before dividing by 8. What does it compute?
Check
An array of 8-byte elements starts at 4096.
(a)
What address does element 3 occupy?
(b)
How many bytes does the debugger's memory view show for one element?
Check
A program prints a 40-character line over a 9600-baud UART and waits for each character.
(a)
How long does it spend printing?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How many 10 MHz cycles is that?
Check
Address of element 12 of 2-byte elements at 1000?
Check
Stops for a breakpoint in a 12-pass loop inside a 5-pass loop?
Check
Time to print 32 characters at 9600 baud?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A keypad has 8 buttons, each pulling its own 4.7 kΩ pull-up to ground when pressed. A user holds one down for 24 hours a day.
(a)
What current does a pressed button draw?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How much charge does that take from the battery each day?
(c)
What if all 8 were held at once?
Check
A 12 V logic signal must drive a 3.3 V pin through a divider: 10 kΩ in series, then a resistor to ground. Its high level should land at 3.0 V.
(a)
What resistor to ground?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
What source resistance does the pin then see?
Check
An open-drain line has a 4.7 kΩ pull-up to 3.3 V and 50 pF of capacitance. It's released from 0 V.
(a)
How long until it reads 1?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
If the line must be high at least half of each period and the rise takes up all of that half, what is the fastest square wave it can carry?
Check
A pin leaks up to 1 µA to ground, and its pull-up is 100 kΩ.
(a)
What voltage does the released pin sit at?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
Does it still read 1 (1 for yes)?
(c)
What is the largest pull-up that keeps it reading 1?
Check
A button discharges a capacitor of 0.1 µF through 47 kΩ as a hardware debouncer; the pin starts at 3.3 V.
(a)
How long after the press does the pin fall below 0.99 V?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
If a bounce opens the contact once the pin has reached 0.1 V, how long must it stay open to recharge the pin past 0.99 V? (The pin then charges back toward 3.3 V through the same resistance.)
Check
A counter debouncer samples every 2 ms and accepts a new level after 4 equal samples. A switch bounces for up to 10 ms.
(a)
What is its worst-case delay after the bouncing ends?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And after the first contact?
(c)
If each sample is a 30-cycle timer interrupt, what share of the 10 MHz processor does it take?
Check
A button bounces 10 times on each press and each release, so each press and release makes falling edges. A falling-edge interrupt of 40 cycles fires on every falling edge; it's pressed 6 times a second.
(a)
How many falling edges arrive per second?
(b)
What share of the 10 MHz processor do they use?
Check
An array of structs, each 12 bytes, starts at address 8192. A field sits at offset 8 in each struct.
(a)
What address holds the field of element 7?
(b)
A watchpoint covers aligned 4-byte words. What address does it watch?
Check
A conditional breakpoint if (j == 7) sits in an inner loop for j < 20 inside an outer loop for i < 10.
(a)
How many times does it stop?
(b)
How many times would an unconditional one stop?
Check
A memory view shows the bytes 52, 18, 7, 1 (in decimal, lowest address first) at the address of a uint32_t.
(a)
What value does it hold?
(b)
What does a uint16_t at the same address hold?
Check
A control loop has a 20 ms deadline. A debug print of 20 characters at 9600 baud is added to it, waiting for each character.
(a)
How long does the print take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
Does the print alone fit in the deadline (1 for yes)?
Check
A stack of 1024 bytes is painted at reset. After testing, 200 bytes at the bottom are untouched. The team wants a 50% margin over the high-water mark.
(a)
What is the high-water mark?
(b)
What stack size meets the margin?
(c)
How much RAM does resizing free (negative if more is needed)?
Check
A logic analyzer must catch pulses 2 µs wide with at least 4 samples each, over a 1 s capture.
(a)
What sample rate does it need?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
(b)
How many samples per channel does the capture hold?
Check
A 22 kΩ pull-up and a 10 pF pin are toggled by an open-drain output as a 5 kHz square wave.
(a)
How long does each rise take to reach a logic 1?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
What share of the high half-period does that delay take?
Check
A Schmitt-trigger input switches high above 1.8 V rising and low below 1.2 V falling. A slow sensor drives it with , τ = 10 ms.
(a)
When does it switch high?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is the largest noise, peak to peak, that can't make it switch back once it's high and settled near its switching point?
Check
A timer has PRESCALE = 9 and TOP = 99, on the 10 MHz clock. How long between wraps?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
At what rate does a timer with PRESCALE = 99 count?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
With PRESCALE = 9, what TOP makes the timer wrap every 2 ms?
Check
With PRESCALE = 9, by how much can the period be adjusted, at the finest?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A pin toggles at each timer wrap, making a square wave. With PRESCALE = 0, what TOP gives the closest to 440 Hz?
Check
A 32-bit cycle counter read 4,294,967,000 at one event and 1000 at the next, having wrapped through zero in between. How many cycles passed? (This is what t2 - t1 gives in unsigned 32-bit arithmetic.)
Check
Using the hardware timer and its flag (not a delay loop), toggle P0 every MS (5) ms.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
Blink the LED on P0 at 5 Hz using machine.Timer with a callback, not a sleeping loop.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
The timer wraps at Hz, with PRESCALE = 9.
(a)
What TOP gives 100 Hz (nearest)?
(b)
What frequency does that give exactly?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A 16-bit counter ticking at 1 MHz read 65000 at the start and 16 at the end.
(a)
How long was the interval?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
What is the longest interval it can time unambiguously?
Check
Wrap period with PRESCALE 4, TOP 199?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
TOP for 5 ms with PRESCALE 9?
Check
TOP (PRESCALE 0) for a 440 Hz square wave?
Check
An ISR takes 200 cycles and fires 1 thousand times a second. What percentage of the 10 MHz processor does it use?
Check
An ISR takes 125 cycles. Above what interrupt rate can't the processor keep up, even doing nothing else?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
An interrupt's response takes 12 cycles. What's the latency, at 10 MHz?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
An ISR saves and restores 5 registers, one instruction each way per register, and fires 1 thousand times a second. What share of the processor goes to that saving and restoring?
Check
count is 10. Main loads it, the ISR increments it and returns, then main adds 1 to its loaded copy and stores it. What is count now?
Check
An interrupt fires 10 thousand times a second and costs 30 cycles on the 10 MHz board.
(a)
What share of the processor does it use?
(b)
At most how many thousand per second could it run, using everything?
Check
Interrupt entry takes 12 cycles, and interrupts are disabled for at most 10 cycles at a time.
(a)
What is the worst-case latency at 10 MHz?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How much of that is the critical section?
Check
Load of an 80-cycle ISR at 5 kHz?
Check
Highest rate for a 500-cycle ISR?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
Latency of 12 cycles?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A capture timer at 1 MHz records edges 25000 counts apart.
(a)
What is the signal's frequency?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
What is the resolution for ±1 count?
Check
A 500-line encoder, decoded 4×, turns at 600 rpm; each edge costs an 80-cycle interrupt at 10 MHz.
(a)
How many edges arrive per second?
(b)
What share of the processor does decoding take?
Check
A 256-line encoder in 4× mode gives 150 counts in a 20 ms window.
(a)
What is the speed?
(b)
What fraction of the reading is one count?
Check
An ultrasonic echo returns 5.83 ms after the ping, in air at 0 °C, where sound travels at m/s.
(a)
How far away is the target?
Write units the way you normally would: 1.5 cm, 15 mm and 0.015 m are the same answer.
(b)
What distance does one 100 ns count represent?
Check
A frequency is measured either by counting edges for 0.1 s or by timing one period with a 10 MHz clock.
(a)
Above what frequency is counting better?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
What does counting resolve?
Check
A 16-bit capture timer runs at Hz with PRESCALE = 9.
(a)
What is the longest period it can time without counting overflows?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is its resolution?
Check
Frequency from captures 1000 counts apart at 1 MHz?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
Edges per second for a 200-line encoder at 1200 rpm, 4× decoding?
Check
Distance for an echo after 2 ms at 343 m/s?
Write units the way you normally would: 1.5 cm, 15 mm and 0.015 m are the same answer.
Check
A button to ground has a 40 kΩ pull-up; the pin and its wire have 20 pF.
(a)
What current flows while it's pressed?
Write units the way you normally would: 1.5 µA, 1500 nA and 0.0015 mA are the same answer.
(b)
After release, how long until the pin crosses 70% of 3.3 V?
Check
A button's contacts bounce 2 times on every press and on every release; it's pressed 5 times.
(a)
How many falling edges does a fast program see?
(b)
How many does a correct debouncer count?
Check
A debouncer samples every 2 ms and accepts a level after 4 equal samples; the bounce lasts 8 ms.
(a)
How long does it take to accept a settled level?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
About how long after the first contact does it report the press?
Check
An array of 16 elements of 2 bytes starts at 1000, and a loop runs from 0 to 16 inclusive.
(a)
What address does its last pass read, in hex?
(b)
How many bytes past the end of the array does that read start?
Check
A timer has PRESCALE = 99 and TOP = 499, and a pin toggles at each wrap.
(a)
How long between wraps?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What frequency is the pin's square wave?
Check
A pin must square-wave at 1000 Hz from a timer with PRESCALE = 0.
(a)
What TOP comes closest?
(b)
What frequency does it actually make?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
An ISR takes 300 cycles and fires 2 thousand times a second.
(a)
What share of the processor does it use?
(b)
What rate would use all of it?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
An ISR saves and restores 6 registers and takes 3 cycles to reach its first useful instruction after that.
(a)
How many cycles from entering the ISR to its first useful instruction?
(b)
And in microseconds?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
count is 19. While main does count = count + 1 (load, add, store), 2 ISR increments land between its load and its store.
(a)
What is count afterwards?
(b)
How many increments were lost?
Check
A 32-bit cycle counter read 4294966000 at one event and 300 at the next, wrapping in between.
(a)
How many cycles passed?
(b)
How long is that?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A debug print sends 30 characters over the UART at 9600 baud, waiting for each.
(a)
How long does it take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How many clock cycles is that?
Check
A breakpoint sits in the innermost of three nested loops of 3, 10 and 4 passes.
(a)
How many times does it stop the program?
(b)
And a breakpoint in the middle loop's body, outside the inner loop?
Check
A 16-bit capture timer runs at Hz with PRESCALE = 0 and records edges 5000 counts apart.
(a)
What frequency is that?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
What is the lowest frequency it can measure without counting overflows?
Check
A 360-line quadrature encoder is decoded 4× and turns at 60 rpm.
(a)
How many counts per revolution?
(b)
What angle is one count?
(c)
How many counts per second?
Check
An ultrasonic echo returns 2.9 ms after the ping at 15 °C (sound at m/s), timed by a 1 MHz capture.
(a)
How far is the target?
Write units the way you normally would: 1.5 mm, 1500 µm and 0.0015 m are the same answer.
(b)
How much would the reading be off if the firmware assumed a temperature 5 °C too low?
Check
The button on P4 (to ground) is pressed once, for 50 ms. Print how long it was held, in whole milliseconds (rounded), using the free-running SYS_CYCLES counter at 10 MHz.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
What code does the 12-bit ADC report for 1 V?
Check
The ADC reads 1000. What voltage is that?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
A thermistor from 3.3 V to the pin, with 10 kΩ to ground, gives 1.2 V. What's the thermistor's resistance?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
Check
A thermistor with R₀ = 10 kΩ at 25 °C and B = 3950 K measures 6.5 kΩ. What's its temperature?
Check
Single readings scatter by 4 codes (standard deviation). What's the scatter of an average of 16?
Check
Each conversion takes 10 µs. If a program averages 16 conversions per reading and does nothing else, how many readings a second can it make?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A potentiometer on ADC0 sits at some voltage. Print its raw code, then its voltage in millivolts, rounded to a whole number.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
The 12-bit ADC (0 to 4095 for 0 to 3.3 V) measures 2.2 V.
(a)
What code does it give (nearest)?
(b)
How many millivolts is one code?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
A thermistor from 3.3 V to the pin, with 10 kΩ from the pin to ground, gives code 2048.
(a)
What is the pin voltage?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What is the thermistor's resistance?
Check
Code for 0.5 V?
Check
Thermistor resistance at 1.2 V with 10 kΩ below?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
Check
Temperature at 4.7 kΩ (10 kΩ, B 3950)?
Check
A source of 10 kΩ drives a 12-bit ADC that samples onto 5 pF through 1 kΩ.
(a)
What is the time constant?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
What acquisition time settles a full-scale step to half a code?
Check
A 10 kΩ source (plus 1 kΩ switch) charges 10 pF for 2 µs after a full-scale step on a 12-bit ADC.
(a)
How many codes short is the reading?
(b)
What fraction of the step did it reach?
Check
A 12 V supply is measured through 100 kΩ over 33 kΩ.
(a)
What does the pin see?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What current does the divider draw?
(c)
What source resistance does the ADC see?
Check
A 10-bit ADC samples onto 10 pF.
(a)
What pin capacitor keeps the charge-sharing error under half a code?
Write units the way you normally would: 1.5 nF, 1500 pF and 0.0015 µF are the same answer.
(b)
With exactly that capacitor, how many codes does a full-scale charge share dip the pin?
Check
A source of 10 kΩ feeds a 10 nF capacitor at the pin.
(a)
What corner frequency does it make?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
How long does a full-scale change take to settle to half a 12-bit code?
Check
The 3.3 V reference is actually 1% high, and the input is 1 V.
(a)
What code does the ADC give?
(b)
What error results if the program assumes 3.3 V?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
Acquisition time for a 22 kΩ source, 1 kΩ switch, 10 pF, 12 bits?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
Pin voltage for 6 V through 68 kΩ over 47 kΩ?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
Pin capacitor for half-a-code charge sharing with 8 pF at 12 bits?
Write units the way you normally would: 1.5 nF, 1500 pF and 0.0015 µF are the same answer.
Check
What integer represents 1.25 in a Q format with 8 fraction bits?
Check
In Q format with 16 fraction bits, 0.75 and 2 are stored as integers. What's their product, shifted back right by 16, as an integer?
Check
The ADC reads 1484. What does (c * 3300 + 2047) / 4095 give, in integer arithmetic?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
Interpolate in integers: the table says 1357 → 100 and 2676 → 400. What does 2000 give, truncated?
Check
A computation multiplies a 12-bit code (up to 4095) by 100000 before dividing. What's the largest intermediate value? (A signed 32-bit int holds up to about 2.1 × 10⁹.)
Check
Read the potentiometer on ADC0. Print the raw code, then the voltage in millivolts rounded to the nearest whole millivolt, using only integer arithmetic.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
Write int tenths(int code) using the table from the play (codes at 0, 10, ... 80 °C), interpolating in integers. Print tenths(1500), then tenths(X) for X = 2450.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
−0.75 and 2.25 are multiplied in Q16.16.
(a)
What integer stores −0.75?
(b)
What integer does the product, shifted right by 16, give?
Check
A Q-format number has 8 fraction bits, in 16 bits.
(a)
What unsigned 16-bit pattern stores −0.5?
(b)
What is the largest magnitude it can hold, about?
Check
0.1 with 8 fraction bits, as an integer?
Check
Rounded millivolts for code 1000?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
Largest intermediate of a 12-bit code times 50000?
Check
A moving average of 16 samples runs on readings with 2 codes of rms noise, at 1000 Hz.
(a)
How much noise is left?
(b)
How much delay does it add?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Readings arrive at 1000 Hz with hum at 50 Hz.
(a)
What moving-average length puts its first null on the hum?
(b)
What delay does that average add?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
An exponential smoother uses .
(a)
What is its time constant?
(b)
After how many samples is a step within 1% (whole samples)?
(c)
What fraction of white noise's rms passes?
Check
A running sum averages 64 samples of a 10-bit unsigned ADC.
(a)
What is the largest sum?
(b)
How many bits does the sum need?
Check
A smoother y = y + ((x - y) >> 4) without extra fraction bits starts at 0 with a steady input of 700.
(a)
What is the largest gap at which it stops moving?
(b)
How many fraction bits must the state carry to fix it?
Check
A filter costs 60 cycles per sample on the 10 MHz board and runs at 1 kHz.
(a)
What share of the processor does it use?
(b)
How many such filters could run, at most?
Check
Noise after a 25-sample average of 3 codes rms?
Check
Time constant of a smoother with α = 2^−4?
Check
Moving-average length for a null at 50 Hz, sampling at 1200 Hz?
Check
The thermistor is at 10 °C.
(a)
What is its resistance?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
What voltage reaches the pin?
(c)
What code does the ADC give?
Check
Near 25 °C, compare the thermistor's codes at 25 − 0.5 and 25 + 0.5 °C.
(a)
How many codes per degree is the sensor worth there?
(b)
What temperature step is one code?
Check
A battery of 4.2 V is measured through 100 kΩ over 200 kΩ.
(a)
What code does the ADC read (if the pin stays under 3.3 V)?
(b)
How much charge does the divider draw in a year (8766 hours)?
Write units the way you normally would: 1.5 mAh, 1500 µAh and 0.0015 Ah are the same answer.
(c)
What acquisition time settles a full-scale change to half a code?
Check
A scanned ADC switches between channels; channel A has a 20 kΩ source, and the acquisition time is 1 µs.
(a)
After a full-scale jump from the previous channel, how far off is channel A's reading?
(b)
What acquisition time would bring it within half a code?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
The 3.3 V rail, which is also the ADC's reference, is 2% low. One sensor is the ratiometric thermistor divider; another is a 10 mV/°C sensor whose output doesn't depend on the rail, reading 25 °C.
(a)
How far off does the thermistor read?
(b)
How far off does the 10 mV/°C sensor read, and in which direction (positive for high)?
Check
2.75 and 0.125 are multiplied in Q16.16 on a 32-bit processor.
(a)
How many bits, including the sign, does the product of their stored integers need?
(b)
Does that product overflow a signed 32-bit integer (1 for yes)?
(c)
What value does the product represent after the shift?
Check
A filter coefficient 0.3 is stored with 8 fraction bits.
(a)
What integer stores it?
(b)
How far off is the stored value?
Check
Firmware converts ADC code 2483 to millivolts with mv = code * 3300 / 4095 in 32-bit integers.
(a)
What does it compute?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
(b)
How much does truncation lose?
(c)
What does code / 4095 * 3300 give instead?
Check
Readings arrive at 1000 Hz and carry hum at 50 Hz.
(a)
What moving-average length nulls the hum?
(b)
What is the largest running sum of 12-bit readings it can hold?
(c)
What delay does it add?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A thermistor reading has 3 codes of rms noise, and near this temperature one degree is worth 23 codes. An exponential smoother uses .
(a)
How much noise survives the smoother?
(b)
What is that in degrees?
Check
A 12-bit ADC sampling at 1000 Hz is oversampled and averaged, with enough noise to dither it, to gain 2 bits.
(a)
How many samples must each output average?
(b)
What output rate is left?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A median-of-3 filter runs on readings that contain isolated spikes, never more than 1 in a row.
(a)
Does it remove every spike (1 for yes)?
(b)
What delay does it add to a clean step?
Check
A 16-sample moving average runs at 1000 Hz on readings with 4 codes of rms noise.
(a)
How much noise remains?
(b)
What smoother α leaves the same noise, given that a smoother passes of it?
(c)
What is that smoother's time constant?
Check
A thermistor table covers codes 0 to 4096 every 128 codes with 16-bit entries; a second table covers the same range with 65 entries.
(a)
How much flash does the first table take?
(b)
By roughly what factor is the second table's interpolation error smaller (or larger, below 1)?
Check
A 10 kΩ source with 100 nF at the ADC pin feeds samples taken at 10000 Hz.
(a)
What is the filter's corner frequency?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
What gain does it have at half the sample rate, where aliasing begins?
Check
A pin switches between 0 and 5 V at 15% duty. What's the average voltage?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
What PWM PERIOD, in clock cycles, gives 20000 Hz?
Check
With PERIOD = 500, how many bits of duty resolution does the PWM have?
Check
With PERIOD = 1000, what DUTY value gives 12.5%?
Check
MicroPython's duty_u16(d) takes d from 0 to 65535. What duty cycle is duty_u16(32768)?
Check
Drive the LED on P1 with PWM at 5000 Hz and 25% duty.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
Run the motor on P2 at D% (20%) of full speed using PWM channel 2 at F Hz (4000 Hz), writing the PWM registers directly.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
PWM on the 10 MHz board runs at 1000 Hz.
(a)
What PERIOD?
(b)
How many bits of duty resolution?
Check
PWM with PERIOD = 10000 drives a load that draws 20 mA when on, at 10% duty.
(a)
What DUTY value?
(b)
What average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
Average of 9 V at 30% duty?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
PERIOD for 4000 Hz?
Check
Resolution bits for PERIOD 1000?
Check
An NPN switches a 12 V, 50 Ω coil from a 3.3 V pin, with a forced β of 20.
(a)
What collector current flows (ignore )?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
What base resistor?
Check
A MOSFET with = 20 mΩ carries 2 A at 75% duty; its package has 60 °C/W to ambient.
(a)
What is its conduction loss?
Write units the way you normally would: 1.5 W, 1500 mW and 0.0015 kW are the same answer.
(b)
How far above ambient does it run?
Check
A switch turns 1 A at 24 V on and off at 100 kHz, with 2 µs per transition.
(a)
What is its switching loss?
Write units the way you normally would: 1.5 W, 1500 mW and 0.0015 kW are the same answer.
(b)
What fraction of the power it switches is that?
Check
A MOSFET's gate needs 15 nC and is driven with 8 mA.
(a)
About how long is each transition?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
What gate-drive power does 20 kHz switching at 3.3 V take?
Check
A coil of 100 mH and 50 Ω carries its full 12 V current when the switch opens; it releases at 30% of that.
(a)
How long does release take with a plain flyback diode?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And with a 48 V Zener in series with the diode?
(c)
What peak voltage does the switch see then?
Check
A pin-driven MOSFET has = 30 mΩ at 3.3 V gate drive and carries 0.5 A continuously.
(a)
What voltage does it drop?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
(b)
What does it dissipate?
Check
Base resistor for 50 mA at forced β 10 from 3.3 V?
Write units the way you normally would: 1.5 Ω, 1500 mΩ and 0.0015 kΩ are the same answer.
Check
Switching loss: 12 V, 2 A, 0.5 µs per transition, 200 kHz?
Write units the way you normally would: 1.5 W, 1500 mW and 0.0015 kW are the same answer.
Check
Decay time constant of a 50 mH, 60 Ω coil with a flyback diode?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
What's the frequency of MIDI note 60?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
What PWM PERIOD comes closest to 523 Hz on the 10 MHz board?
Check
What frequency does PERIOD = 22727 make?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A note meant to be 440 Hz plays at 445 Hz. How many cents off is it?
Check
At 90 beats per minute, how long is a note of 1 beats?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A 440 Hz square wave: at what frequency is its harmonic number 3?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
Play MIDI note N (64) on the speaker on PWM channel 2, as a 50% square wave. (The frequency table is up to you: compute it, or hard-code it.)
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
A timer toggles a buzzer pin on each wrap to play 440 Hz.
(a)
What TOP (with PRESCALE = 0, nearest)?
(b)
What frequency actually plays?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A tune is written at 96 beats per minute, a quarter note per beat.
(a)
How long is a quarter note?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How long is a dotted quarter (one and a half beats)?
Check
Frequency of MIDI note 62?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
PERIOD for 440 Hz?
Check
Length of a 0.5-beat note at 100 BPM?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
What DAC code gives 1.25 V?
Check
The DAC holds 1000. What's its output?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
A 16-sample table is played at 16000 samples per second. What frequency comes out?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
What sample rate plays a 32-sample table at 440 Hz?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
A phase accumulator updates 8000 times a second. What 32-bit step makes 440 Hz?
Check
A full-scale 32-entry sine table centered at mid-scale: what's entry 5?
Check
Make the DAC output MV millivolts (1250 mV), as close as its 12 bits allow, using integer arithmetic.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
In MicroPython, set the DAC to 1.65 V.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
The 12-bit DAC spans 0 to 3.3 V.
(a)
What code gives 1.2 V?
(b)
What is one step?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
A 32-bit phase accumulator updates at 10 kHz.
(a)
What step plays 100 Hz?
(b)
What is its frequency resolution?
Write units the way you normally would: 1.5 mHz, 1500 µHz and 0.0015 Hz are the same answer.
Check
DAC code for 1 V?
Check
Frequency of a 128-sample table at 20000 Hz?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
32-bit DDS step for 1000 Hz at 48000 Hz?
Check
A sensor puts 1.9 V on an ADC pin.
(a)
What code does the ADC report?
(b)
What does (code * 3300 + 2047) / 4095 give, in integers?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
The thermistor divider reads code 2700.
(a)
What's the thermistor's resistance? (V cancels: .)
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
What's the temperature?
Check
Single ADC readings scatter with a standard deviation of 8 codes; the program averages 16.
(a)
What's the scatter of the average, in codes?
(b)
How long do the conversions take, at 10 µs each?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A value 2.6 is stored in a Q format with 8 fraction bits.
(a)
What integer stores it?
(b)
What's the format's resolution?
Check
A table maps code 1357 to 100 tenths of a degree and 1817 to 200.
(a)
What does code 1500 interpolate to, in integer arithmetic?
(b)
What's the largest intermediate product the calculation can reach in this segment?
Check
A motor runs from 12 V through a transistor switched by PWM at 1000 Hz and 30% duty.
(a)
What average voltage does it see?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What DUTY register value gives that, with PERIOD set for 1000 Hz?
Check
PWM must run at 20000 Hz.
(a)
What PERIOD does it need?
(b)
How many bits of duty resolution does that leave?
Check
A tune needs MIDI note 67.
(a)
What's its frequency?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
What PWM PERIOD plays it?
Check
A melody at 80 beats per minute has a note of 0.25 beats, followed by a 40 ms gap that's part of the note's time.
(a)
How long is the note's whole slot?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How long does the tone actually sound?
Check
A 64-sample waveform table is played at 8000 samples per second.
(a)
What frequency results?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
With PRESCALE = 0, what timer TOP sets that sample rate?
Check
A phase accumulator updates at 10000 Hz.
(a)
What 32-bit step gives 261.6 Hz?
(b)
What's its frequency resolution?
Write units the way you normally would: 1.5 µHz, 1500 nHz and 0.0015 mHz are the same answer.
Check
The DAC must output 1650 mV.
(a)
What does (m * 4095 + 1650) / 3300 give, in integers?
(b)
What voltage does that code actually produce?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
A 47 kΩ source drives an ADC that samples onto 10 pF through 1 kΩ, with 10 µs of acquisition time.
(a)
What acquisition time does 12-bit settling need?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
Is 10 µs enough (1 for yes)?
Check
An NPN switches a 12 V, 50 Ω solenoid from a 3.3 V pin with a forced β of 20; the pin may source 8 mA.
(a)
What base current does it need?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
Can the pin supply it (1 for yes)?
Check
Readings with 5 codes of rms noise pass through either an 8-sample moving average or a smoother with .
(a)
How much noise does the moving average leave?
(b)
And the smoother?
Check
An LED with forward voltage 2 V is driven from a 3.3 V pin through 150 Ω.
(a)
What current does it draw?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
What's its average current with 40% PWM?
Check
A register sits at offset 4 from 40003000, and a program needs a mask for pin P12.
(a)
What's the register's address, in hex?
(b)
What's the mask, in hex?
Check
A MicroPython loop makes 4 hardware calls and sleeps 200 ms each pass.
(a)
How long is a pass?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How far behind an exact grid is it after 1000 passes?
Check
A uint8_t register holds E7.
(a)
What's bit 1?
(b)
What does it hold after x ^= 1 << 1, in hex?
Check
A pull-up of 10 kΩ charges 30 pF of pin capacitance.
(a)
How long until the pin reads high after release? (kΩ × pF = ns)
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
What current flows while the button is held?
Check
A button bouncing 3 times each way is pressed 4 times; a debouncer samples every 4 ms and needs 5 equal samples.
(a)
How many falling edges would a naive counter see?
(b)
How long after settling does the debouncer accept a level?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A timer has PRESCALE = 49 and TOP = 199.
(a)
How long between wraps?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What's the length of one count?
Check
An ISR of 150 cycles, saving and restoring 16 registers inside that time, fires 4 thousand times a second.
(a)
What share of the processor does it use?
(b)
What share of the ISR's own time is saving and restoring?
Check
A loop reads an array of 20 2-byte elements at 1000, but its test is i <= 20.
(a)
How many elements does it read?
(b)
What address does the extra read come from, in hex?
Check
A thermistor divider (10 kΩ, B = 3950, under a 10 kΩ resistor) gives 1.4 V.
(a)
What's the thermistor's resistance?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
What temperature is that?
Check
The ADC reads 2111.
(a)
What does c * 3300 / 4095 give, in integers?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
(b)
And the rounded version, (c * 3300 + 2047) / 4095?
Check
PWM must run at 2000 Hz and 15% duty.
(a)
What's PERIOD?
(b)
And DUTY?
Check
A buzzer must play MIDI note 60.
(a)
What frequency?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
With PERIOD rounded to a whole number, how many cents off is it?
Check
A DAC plays a 32-sample table at 10000 samples per second; separately, it's asked for 2.2 V.
(a)
What frequency does the table play?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
What code gives 2.2 V?
Check
count is 12. Main runs count = count + 1 (load, add, store), and 1 ISR increments land between its load and store.
(a)
What is count afterwards?
(b)
What should it be?
Check
A relay coil of 50 mH and 50 Ω and a motor drawing 2 A are both switched from GPIO through low-side MOSFETs with 80 mΩ on-resistance.
(a)
With a flyback diode, what is the coil current's decay time constant at turn-off?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What does the motor's MOSFET dissipate when on?
Check
How long is one bit at 57600 baud?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
How long does it take to send 1 bytes at 9600 baud, back to back?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
What BAUDDIV comes closest to 38400 baud on the 10 MHz board?
Check
With BAUDDIV rounded, how far off 230400 baud is the board, in percent (negative if slow)?
Check
The byte 4B is sent. Write its eight data bits in the order they appear on the wire, first bit on the left, as a binary number.
Check
What's the most bytes per second a UART can send at 4800 baud, with 8 data bits and one stop bit?
Check
Send the text N= followed by the number N (307) in decimal and a newline, at 115,200 baud. (Convert the number to digits yourself.)
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
The UART runs at baud; 57600 baud is wanted.
(a)
What BAUDDIV?
(b)
How far off is the actual rate?
Check
A UART at 115200 baud uses 8 data bits, no parity and 1 stop bit(s).
(a)
How long does one byte take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How many bytes per second?
Check
Bit time at 38400 baud?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
Time for 10 bytes at 57600 baud?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
BAUDDIV for 31250 baud?
Check
A ring buffer's head counter is 77 and its tail counter is 970. How many bytes are waiting?
Check
In a 16-slot ring buffer, which slot does counter 100 use?
Check
At 115200 baud, how often does a new byte arrive in a continuous stream?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
The main program may be busy for up to 2 ms while bytes stream in at 9600 baud. How many bytes must the buffer hold, at least?
Check
A receive ISR takes 40 cycles per byte. At 115200 baud, what share of the processor does it use?
Check
Write a 16-slot ring buffer of uint8_t with void put(uint8_t v) and int get(void) (−1 when empty). Put A bytes (10), get B (3), print how many are waiting; put 4 more and print again; then print the value of the next byte read, if the bytes put were 1, 2, 3, ... in order.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
A program may be away for 12 ms while bytes arrive at 9600 baud.
(a)
How many bytes can arrive meanwhile?
(b)
What power-of-two buffer holds them (one slot stays empty)?
Check
A ring buffer of 64 bytes has head = 3 and tail = 200.
(a)
How many bytes are waiting?
(b)
How many more can it take?
Check
Bytes waiting with head 2049, tail 2030?
Check
Slot for counter 300 in 32 slots?
Check
Buffer bytes for 2 ms away at 57600 baud?
Check
A device's address is 48. What's the first byte after start to 0? (0 write, 1 read)
Check
A positive reading arrives as 19, 00. What's the temperature?
Check
In 12-bit two's complement at 0.0625 °C per count, what raw value does −10 °C produce?
Check
At 100 kHz, a transaction sends 2 bytes (each 9 clocks) plus about one clock for the start and stop. How long does it take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
The bus has 50 pF and must rise in 300 ns. What's the largest pull-up?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
Check
A temperature sensor sits somewhere on the I²C bus. Scan every address from 0x08 to 0x77 and print the one that acknowledges.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
The sensor at 0x48 is below freezing. Read it and print its temperature in °C, handling negative values.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
An I²C bus has 50 pF and must rise in 300 ns.
(a)
What is the largest pull-up?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
What current does a device sink pulling it low?
Check
A temperature sensor returns bytes 50 then 128; the reading is the 16-bit value shifted right by 4, in sixteenths of a degree, and positive here.
(a)
What is the 12-bit reading?
(b)
What temperature?
Check
First byte to address 20, direction 0?
Check
Temperature from 0A, 40?
Check
Largest pull-up for 150 pF at 100 kHz?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
Check
A UART at 115200 baud sends 64 bytes with 8 data bits, 1 parity bit(s) and one stop bit.
(a)
How many bit-times does each byte take?
(b)
How long do the 64 bytes take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A receiver resynchronizes on each start bit and samples the stop bit's center, 8.5 bit-times later. The transmitter and receiver clocks differ.
(a)
What total rate mismatch puts that sample exactly on the stop bit's edge?
(b)
If both ends may be off by the same amount in opposite directions, what may each be off by?
Check
The UART's receive register holds one byte, and a new byte finishes arriving every byte-time while data streams in at 57600 baud.
(a)
How long can the program leave a received byte unread before the next overwrites it?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How many 10 MHz cycles is that?
Check
A burst of 200 bytes arrives at 57600 baud while the main loop removes bytes from the ring buffer at 5000 bytes per second.
(a)
How many bytes pile up by the burst's end?
(b)
What power-of-two buffer holds them, keeping one slot empty?
Check
A ring buffer of 1024 bytes uses free-running 16-bit head and tail counters. Head is 10 and tail is 65500.
(a)
How many bytes are waiting?
(b)
At what index in the array does the next byte go?
Check
A UART at 115200 baud receives continuously. Either an interrupt of 40 cycles handles each byte, or DMA moves the bytes and interrupts once per 256-byte block at 300 cycles.
(a)
What share of the 10 MHz processor does the per-byte interrupt use?
(b)
And the DMA's block interrupt?
Check
An I²C device has the 7-bit address 68.
(a)
What byte starts a write to it?
(b)
And a read?
Check
4 sensors are each read once per cycle with a register read of 2 data bytes at 400 kHz (address, register, repeated start, address, data, plus about 3 clocks).
(a)
How long does a full cycle take on the bus?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is the fastest cycle rate the bus allows?
Check
An I²C bus has 150 pF and must rise in 300 ns; devices sink at most 3 mA at 0.4 V.
(a)
What is the smallest pull-up allowed?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
And the largest?
Check
A humidity sensor holds the clock low (clock stretching) for 25 ms while it converts, then returns 2 bytes; the read takes clocks at 400 kHz besides.
(a)
How long is the whole transaction?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What share of it is the bus held idle?
Check
A sensor returns 255 then 0: a 12-bit two's-complement reading, left-justified, in sixteenths of a degree.
(a)
What signed 12-bit value is it?
(b)
What temperature?
Check
A message has 4 header bytes, 8 payload bytes and a 2-byte CRC, and is COBS-encoded with a zero delimiter, at 9600 baud.
(a)
How many bytes go on the wire (COBS adds one byte for a message this short)?
(b)
How long does it take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
The board needs 19200 baud from .
(a)
What BAUDDIV?
(b)
What is the rate's error?
Check
A command line echoes each character: the receive interrupt queues it, the main loop (whose passes take up to 1 ms) handles it, and the echo is sent at 9600 baud.
(a)
What is the worst-case delay from the start of a typed character to the end of its echo?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
Is it under the 100 ms at which a person notices lag (1 for yes)?
Check
A receive ISR of 30 cycles copies each byte into a ring buffer; a 16-byte line arrives back to back at 115,200 baud, and then the main loop parses it in 2000 cycles.
(a)
How many cycles does one line cost in all?
(b)
What share of the processor is that, over the time the line takes to arrive?
Check
This board's SPI clock is . What's the SPI clock with CLKDIV = 2?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
How long does it take to clock 4 bytes over SPI at 1 MHz?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
Segments a to g are bits 0 to 6. Light exactly the segments that show the digit 3. What byte is that, in hex?
Check
How many output pins do 2 daisy-chained 8-bit shift registers give?
Check
SPI sends 5B most significant bit first. What level is the 1th bit on MOSI?
Check
Show the digit D (4) on the seven-segment display: CS is P13 (active low, latching on its rise), and the byte goes over SPI.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
Eight LEDs hang off the shift register (bit 0 is the bottom LED). Light the bottom 3 of them, as a level meter would.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
An SPI transfer of 16 bits runs at 1 MHz.
(a)
How long does it take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How many transfers a second could it make back to back?
Check
4 daisy-chained 8-bit shift registers are updated over SPI at 1 MHz.
(a)
How long does one update take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How many clock pulses is that?
Check
SPI clock with CLKDIV 4?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
Check
Time for 2 bytes at 2 MHz?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
Outputs from 4 chained shift registers?
Check
What's the 8-bit sum checksum (modulo 256) of the bytes 200, 100 and 180, in hex?
Check
A frame's bytes sum to 7F (mod 256). What checksum byte makes the total 0?
Check
A frame has 3 header bytes, an 8-byte payload and a 1-byte checksum. What fraction of it is payload?
Check
A reply of 20 characters goes out at 9600 baud. How long does it take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A command's argument arrives as the characters '4', '0', '8' (ASCII codes 48 + digit). Accumulating n = n*10 + (c - '0') for each, what's n?
Check
A payload is the bytes A, B and C (170, 32, 99). Print its 8-bit sum checksum, then the byte that would make the frame's total zero (0 if the sum is already 0).
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
A payload is 16, 32, 7.
(a)
What is its 8-bit sum?
(b)
What checksum byte makes the total 0 modulo 256?
Check
A command line answers with 12 characters at 9600 baud.
(a)
How long is the answer on the wire?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
At most how many such answers a second?
Check
Sum checksum of 77, 200, 128, in hex?
Check
Byte that zeroes a sum of 3C?
Check
Payload share with 2 header bytes, 16 payload, 1 checksum?
Check
A UART runs at 57600 baud and sends 16 bytes back to back.
(a)
How long is one bit?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How long do the 16 bytes take?
Check
The board must run its UART at 115200 baud.
(a)
What BAUDDIV?
(b)
How far off is the actual rate, in percent?
Check
Bytes stream in at 115200 baud; the main loop may be away for 3 ms.
(a)
How many bytes arrive meanwhile?
(b)
What's the smallest power-of-two ring buffer that holds them?
Check
A 32-slot ring buffer has head = 260 and tail = 4990.
(a)
How many bytes are waiting?
(b)
Which slot does the next byte go in?
Check
A receive ISR takes 30 cycles per byte at 115200 baud.
(a)
What share of the processor does it use?
(b)
How much time is there between bytes?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
An I²C device answers at address 3C.
(a)
What byte starts a write to it, in hex?
(b)
And a read?
Check
A register read over I²C at 100 kHz sends 3 bytes in all, plus about two clocks for the start, repeated start and stop.
(a)
About how long does it take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
About how many such reads fit in a second?
Check
A 12-bit sensor reading arrives left-justified as E7, 40, in sixteenths of a degree, two's complement.
(a)
What's the 12-bit pattern, as an unsigned number?
(b)
What's the temperature?
Check
An I²C bus has 80 pF and needs rise times under 300 ns.
(a)
What's the largest pull-up?
Write units the way you normally would: 1.5 kΩ, 1500 Ω and 0.0015 MΩ are the same answer.
(b)
What current flows through that pull-up when a device holds the line low?
Check
The SPI runs with CLKDIV = 5 (clock ) and sends 2 bytes.
(a)
What's the SPI clock?
Write units the way you normally would: 1.5 MHz, 1500 kHz and 0.0015 GHz are the same answer.
(b)
How long do the bytes take?
Check
3 shift registers are daisy-chained on SPI at 1 MHz.
(a)
How many outputs do they drive?
(b)
How long does a full update take on the wire?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A frame has 3 header bytes, then the payload 150, 140, 200, then a checksum byte.
(a)
What's the payload's sum, modulo 256?
(b)
What fraction of the frame is payload?
Check
A display of 4 seven-segment digits is multiplexed: each refresh sends 16 bits over SPI at 1 MHz to light one digit, cycling through all digits 200 times a second.
(a)
What share of the SPI bus does refreshing take?
(b)
What fraction of the time is each digit lit?
Check
A command SET LED n plus newline (4 characters in all) is sent at 9600 baud; a line with a bad checksum is resent, and 4 in 100 lines are bad.
(a)
How long does one line take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is the average time per delivered line, counting resends?
Check
A 24-bit ADC on SPI at 2 MHz is read with 8 extra command bits each time, and the CPU spends 16 cycles setting up each transfer.
(a)
How long is each transfer on the wire?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
What is the most readings a second it can make, back to back?
Check
The crossing spends at least 1000 ms in green, 300 in yellow, 1500 in walk and 1000 in red. With a request always waiting, how long is one full cycle?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
How many bits does it take to store one of 5 states?
Check
A machine has 4 states and 2 kinds of event. How many entries does a complete transition table have?
Check
Green must last at least 1000 ms, and the walk button is pressed 400 ms after green began. When does green end?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A button cycles a machine through 3 states (0 → 1 → 2 → 0 ...), starting at 0. After 5 presses, which state is it in?
Check
A table-driven state machine has 6 states and 3 events, 2 byte(s) per entry.
(a)
How big is the table?
(b)
How many transition tests cover every entry?
Check
A crossing runs green 10 s, yellow 3 s, all-red 2 s, then walk 12 s, and back to green.
(a)
How long is a full cycle?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
If a pedestrian presses just as green starts, how long until walk begins (green runs its full time)?
Check
Cycle time: green 2000, yellow 400, walk 2000, red 600 ms?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Bits for 6 states?
Check
Table entries for 5 states and 3 events?
Check
Task 1 takes 0.2 ms every 5 ms; task 2 takes 10 ms every 250 ms. What's the processor's utilization?
Check
In a superloop, task A's turns take up to 0.5 ms and task B's up to 8 ms. How late can each task's turn start, at worst, because of the other? Give the larger of the two.
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A task runs every 25 ms. How many times does it run in 1 seconds?
Check
A task's 60 ms of work is split into pieces of 1 ms, one per turn. How many turns does it take?
Check
A task's next due time is 4294967290 ms on a 32-bit clock, and its period is 10 ms. After next += period, what does next hold?
Check
Toggle P0 every A ms (125) and P1 every B ms (30) from one superloop, without blocking either.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
The same in MicroPython: toggle P0 every 100 ms and P1 every 40 ms from one loop.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
Three tasks run 0.5 ms every 5 ms, 4 ms every 50 ms and 5 ms every 100 ms.
(a)
What is the processor's utilization?
(b)
In a round-robin superloop, what's the longest the first task can wait for its turn?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
150 ms of slow work is split into slices of 5 ms so other tasks can run between them.
(a)
How many slices?
(b)
What is the longest it now holds the processor at once?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Utilization of (0.5 ms every 10 ms) and (15 ms every 500 ms)?
Check
Runs of a 20 ms task in 5 s?
Check
Turns for 90 ms of work in 3 ms pieces?
Check
Task 1 runs 2 ms every 5 ms at high priority; task 2 needs 7 ms at lower priority.
(a)
What is task 2's worst-case response time?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What share of the processor does task 1 take?
Check
Three tasks: 1 ms every 4 ms, 5 ms every 20 ms, 3 ms every 15 ms.
(a)
What is their total utilization?
(b)
Is it under the three-task bound of 78.0% (1 for yes)?
Check
A high-priority task waits for a mutex held for 1 ms by a low-priority task; a medium-priority task can run for 5 ms.
(a)
How long can it wait without priority inheritance?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And with it?
Check
A 100 Hz tick costs 30 cycles, and 5000 context switches a second cost 400 cycles each, on the 10 MHz board.
(a)
What share of the processor is overhead?
(b)
How long is one context switch?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
6 tasks get 256-byte stacks on a chip with 32 KB of RAM.
(a)
How much RAM do the stacks take?
(b)
What share of RAM is that?
Check
Response time of a 4 ms task under a 1 ms task every 5 ms?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Worst wait without inheritance: 1 ms critical section, 10 ms medium task?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Rate-monotonic bound for 5 tasks?
Check
A loop polls a flag once per pass; passes take between 0.1 and 0.6 ms. What's the worst-case latency?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A periodic job's measured intervals range from 995 µs to 1010 µs. What's its jitter?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A job's worst-case latency is 40 µs, its worst-case execution time 50 µs, and its deadline 200 µs. How much margin is left (negative if it misses)?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A 1000 Hz signal of amplitude 1 V is sampled with 100 µs of timing jitter. How large can a sample's error be?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
An ISR runs every 100 µs and takes 60 µs. What share of the time does it occupy, and so how long can it hold off everything below it?
Check
A 50 Hz sine of amplitude 1 V is sampled with 30 µs of timing jitter.
(a)
How large can the error be, at most?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
(b)
How many 12-bit ADC codes (0.806 mV each) is that?
Check
3 periodic tasks are scheduled rate-monotonically.
(a)
What is the Liu and Layland utilization bound?
(b)
What does it approach for many tasks?
Check
Worst-case polling latency with passes of 0.2 to 1.5 ms?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Margin: latency 25, execution 80, deadline 250 µs?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
Error from 2 µs jitter on 1.5 V at 400 Hz?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
A table-driven state machine has 8 states and 4 events; each entry holds a next state (1 byte) and an action number (1 byte), and each state has 2 byte(s) of output settings.
(a)
How much flash do the tables take?
(b)
How many tests cover every transition once?
Check
A door controller holds the door open for 3 s, then closes it over 2 s. An obstruction while closing reopens it (taking as long as it had been closing) and restarts the hold. Someone blocks it 3 time(s), each just before it would finish closing.
(a)
How long from when the door is first fully open until it's finally shut?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
How many times does the motor start, counting the first opening (each open or close is one start)?
Check
A superloop runs three tasks in turn, taking at most 0.5, 2 and 30 ms.
(a)
What is the longest the first task can wait for its next turn after finishing?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
If the third task is split into four equal slices, one per turn, what does that wait become for the second task?
Check
Task 1 runs 1 ms every 4 ms and task 2 runs 3 ms every 20 ms, both above task 3, which needs 6 ms and can be blocked for 1 ms by a lower task holding a shared mutex (with priority inheritance).
(a)
What is task 3's worst-case response time?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What share of the processor do the two higher tasks use?
Check
Three tasks: 1 ms every 10 ms, 10 ms every 50 ms, 10 ms every 100 ms, scheduled rate-monotonically.
(a)
What is the utilization?
(b)
How much headroom is left under the three-task bound (negative if over it)?
Check
A task runs 2 ms of work 500 times a second; each run costs two context switches of 20 µs.
(a)
What share of the processor does it take?
(b)
How much of that is switching?
Check
An interrupt takes 50 µs to reach its handler, interrupts can be disabled for up to 100 µs elsewhere, and the handler's job takes 300 µs and must finish within 1500 µs of the event.
(a)
What is the worst-case completion time?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
What is the slack (negative if it misses)?
Check
An RTOS counts time in ticks of 1 ms. A task asks to sleep 5 ms, rounded up to whole ticks, starting at an unknown point within the current tick.
(a)
What is the shortest it can actually sleep?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And the longest?
Check
An ISR puts 16-byte readings into a queue 500 times a second; the consumer task can be kept from running for up to 10 ms by higher-priority work.
(a)
How many entries must the queue hold?
(b)
How much RAM is that?
Check
A 50 Hz sine of amplitude 1 V is sampled either in a polling loop with 1000 µs of timing jitter, or from a timer interrupt with 2 µs.
(a)
What is the polling loop's worst-case sampling error?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
(b)
By what factor does the interrupt reduce it?
Check
A device polls a sensor every 10 ms, waking for 20 µs at 5 mA each time; an interrupt-driven design instead sleeps until the sensor signals, about once a minute, for the same 20 µs.
(a)
What average current does polling add?
Write units the way you normally would: 1.5 µA, 1500 nA and 0.0015 mA are the same answer.
(b)
How many times more often does it wake than the interrupt design?
Check
An RTOS runs 5 tasks; each stack must hold its deepest call chain (256 bytes) plus one interrupt frame (128 bytes), on a chip with 32 KB of RAM.
(a)
How much RAM do the stacks take?
(b)
What share of RAM is that?
Check
A high-priority task can be blocked by a low-priority task holding a mutex for 0.5 ms; a medium task runs 10 ms; another low task holds a second mutex the high task also needs, for 8 ms.
(a)
With priority inheritance, how long can the high task be blocked at worst, if it may meet both mutexes held?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And without it, if the medium task runs once while one of the mutexes is held?
Check
A cooperative scheduler runs 6 tasks that each yield every 2 ms at most. A button press must get a response within 50 ms.
(a)
What is the worst-case wait before the button task runs again?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
Does it meet the response time (1 for yes)?
Check
What WDT_LOAD gives a 50 ms timeout on the 10 MHz board?
Check
A program hangs 200 ms after every start, and its watchdog resets it 20 ms after the last kick (at the hang). How many resets happen in 3 s?
Check
The longest normal gap between kicks is 15 ms. With a 2× margin, what timeout?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A program waits for 1 bytes at 9600 baud, with a timeout of 2 times the time they should take. What timeout is that?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
A fault makes a device reset 20 times a day, and each reset leaves it out of action for 50 ms while it restarts. What percentage of the time is it out of action?
Check
A main loop takes up to 12 ms, and the device may be out of action for at most 100 ms.
(a)
What is the shortest safe watchdog timeout?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is the longest allowed?
Check
A windowed watchdog must be kicked between 5 ms and 20 ms after the last kick. A loop kicks every 30 ms.
(a)
Is that inside the window (1 for yes)?
(b)
How wide is the window?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
WDT_LOAD for 100 ms?
Check
Resets in 5 s: hang after 150 ms, timeout 25 ms?
Check
Timeout for a 5 ms gap with 3× margin?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A device draws 2 mA awake and 0.05 mA asleep, and it's awake 10% of the time. What's its average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
A 1000 mAh battery supplies an average of 0.05 mA. How many days does it last?
Check
An LED drawing 3.9 mA flashes for 5 ms every 10 s. What does it add to the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
The ADC draws an extra 0.6 mA for each 10 µs conversion, and the program converts 100 times a second. What does that add to the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
A device wakes 10 times a second and is awake 0.5 ms each time. What fraction of the time is it awake?
Check
A 1000 mAh battery powers a load averaging 0.052 mA.
(a)
How long does it last?
(b)
In days?
Check
A device sleeps at 0.052 mA and wakes to 2.05 mA for 50 ms every 10 s.
(a)
What is its average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
What share of the average comes from waking?
Check
Average of 3 mA awake 5% of the time and 0.01 mA asleep?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
Days from 600 mAh at 0.1 mA?
Check
Added by a 2 mA, 10 ms flash every 60 s?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
A device erases a flash sector rated for 10000 cycles every time it saves, 1 times a day.
(a)
How long does the sector last?
(b)
In years?
Check
Records of 64 bytes are appended to a log over 8 sectors of 1024 bytes, each rated for 10000 erases; the device saves 1440 times a day.
(a)
How many records fit in a sector?
(b)
How long does the flash last?
Check
A sector erase takes 50 ms at 5 mA from 3.3 V; the system works down to 2.8 V.
(a)
How much energy does the erase need?
Write units the way you normally would: 1.5 mJ, 1500 µJ and 0.0015 J are the same answer.
(b)
What hold-up capacitance supplies it?
Check
A logger writes 16-byte records 10 times a second into a 1 MB circular log of flash rated for 100000 erases.
(a)
How long does the log take to fill once?
(b)
How long until the flash wears out, each sector erased once per lap?
Check
A 64 KB image is written to flash in 256-byte pages taking 2 ms each, after erasing 16 KB sectors that take 20 ms each.
(a)
How long does the whole update take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What share of it is erasing?
Check
Days of life erasing a 3000-cycle sector 24 times a day?
Check
How many 12-byte records fit in a 2048-byte sector?
Check
Hold-up capacitor for 25 ms at 10 mA from 3.3 V down to 2.2 V?
Write units the way you normally would: 1.5 µF, 1500 nF and 0.0015 mF are the same answer.
Check
A device has 512 KB of flash, a 16 KB bootloader and 8 KB of records. How large can each of two A/B application slots be?
Check
How long does it take to send a 200 KB image over a UART at 9600 baud with 10 bits per byte?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
Erasing room for a 210 KB image in flash with 8 KB pages, each taking 40 ms, takes how long?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A bootloader checks a CRC over 64 KB at 4 cycles per byte on a 200 MHz core. How long does that take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A data logger shares its flash pages with firmware updates. Each update erases every page of one A/B slot once; the flash endures 10000 erase cycles per page.
(a)
How many updates can the device take before a slot's pages wear out, alternating slots?
(b)
At 2 updates per day, how many years is that?
Check
Simulate power failures during A/B updates. State: two slots, each None (erased), 'partial', or a version number; and active, the committed slot index. An update to version v runs these steps in order on the inactive slot: erase (slot becomes None), write (becomes 'partial'), finish (becomes v), commit (active switches to it). Write update(state, v, fail_at) that performs steps until index fail_at (0 to 4; 4 means no failure), and boot(state) returning the version that would run, or None if the active slot isn't a complete version. Starting from slots [1, None], active 0, apply 200 updates with fail_at = rng.randrange(5) (rng = random.Random(seed)) and version numbers 2, 3, ...; set bricked (how many times boot returned None after an update) and final (the running version at the end).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
With 128 KB of flash and an 8 KB bootloader (no records), how big can each A/B slot be?
Check
How long does a 50 KB transfer take at 57600 baud?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A state machine has 6 states and 2 kinds of event.
(a)
How many bits does its state need?
(b)
How many entries are in its full transition table?
Check
A crossing holds green for at least 1500 ms, then yellow 400 ms, walk 1200 ms and red 500 ms. The button is pressed 2500 ms into green.
(a)
When does green end?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
When does green come back?
Check
A superloop runs task 1 (0.2 ms every 4 ms) and task 2 (25 ms every 500 ms).
(a)
What's the utilization?
(b)
Task 2's turn can delay task 1 by its whole run time. How many of task 1's periods is that?
Check
A task's 120 ms of work is split into 1 ms pieces, one per superloop turn.
(a)
How many turns does it take?
(b)
How long can it now delay another task, at most?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A job is started by polling in a loop whose passes take 0.1 to 0.8 ms; it runs for 0.5 ms and must finish within 3 ms of its trigger.
(a)
What's its worst-case latency?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How much margin is left at worst (negative if it misses)?
Check
A 60 Hz signal of amplitude 1 V is sampled with 50 µs of jitter.
(a)
How large can a sample's error be?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
(b)
As a percentage of the amplitude?
Check
A main loop's longest normal pass is 6 ms; the watchdog gets a 3× margin.
(a)
What timeout?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What WDT_LOAD, in cycles?
Check
A program hangs 80 ms after each start; its watchdog fires 30 ms after the last kick.
(a)
How many resets happen in 4 s?
(b)
What fraction of the time is it doing useful work?
Check
A device draws 2 mA awake (20% of the time) and 0.05 mA asleep, from a 1200 mAh battery.
(a)
What's its average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How many days does the battery last?
Check
A device wakes 1 times a second for 0.5 ms each time, drawing 2 mA while awake.
(a)
What fraction of the time is it awake?
(b)
What do the wake-ups add to the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
A status LED drawing 3.9 mA flashes for 10 ms every 30 s.
(a)
What does it add to the average?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How long would it alone take to drain a 220 mAh cell?
Check
A fault resets a device 3 times a day; each reset takes 100 ms to recover from.
(a)
How long is it out of action each day?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
What percentage of the day is that?
Check
Under a preemptive scheduler, task 1 runs 1 ms every 4 ms at high priority; task 2 needs 7 ms.
(a)
What is task 2's worst-case response time?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
In a superloop that runs task 1 and then task 2, how long can task 1 wait between the end of one run and the start of the next?
Check
A thermostat saves its schedule 60 times a day as 32-byte records appended to a log over 4 4 KB flash sector(s) rated for 10000 erases.
(a)
How long does the flash last?
(b)
How long if it erased a sector for every save instead?
Check
A high-priority task needs a mutex that a low-priority task holds for 1 ms; a medium-priority task runs for 10 ms.
(a)
How long can the high task be blocked without priority inheritance?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And with it?
Check
A device has 512 KB of flash and a 16 KB bootloader, and receives a 150 KB update over a 921600-baud UART.
(a)
How large can each A/B slot be?
(b)
How long does the transfer take?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A plant with G = 1 and τ = 20 ms is sampled every 0.5 ms under proportional gain 10.
(a)
Where is the loop's pole?
(b)
What is the largest stable gain?
Check
A loop has proportional gain 5 and plant DC gain 0.4.
(a)
What is the steady-state error, as a share of the set point?
(b)
Where does the output settle?
Check
A loop sampled at 5 kHz crosses over at 20 Hz with a total delay of 2.5 samples.
(a)
How much phase margin does the delay cost?
(b)
How many times the crossover is the sample rate?
Check
A gain of 0.75 is stored in Q8 and multiplies an error of 250 codes.
(a)
What integer stores the gain?
(b)
What does the product, shifted right by 8, give?
Check
An integrator adds 0.002 × e every 10 ms; the output is saturated for 30 s with an error of 100 codes.
(a)
How much does the integrator wind up?
(b)
Over how many samples?
Check
A loop needs a crossover of 50 Hz and is sampled at 10 times that.
(a)
What sample rate?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
With 1.5 samples of delay, what phase does it lose?
Check
Steady-state error with P gain 8 and plant gain 1?
Check
Phase lost to 1.5 samples of delay at 2 kHz, crossover 50 Hz?
Check
Q8 integer for a gain of 0.6?
Check
A main loop's longest normal pass is 12 ms. The watchdog gets a 2× margin, and the device may be out of action for at most 500 ms after a hang.
(a)
What timeout does the margin give?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
Does that meet the outage limit (1 for yes)?
(c)
What is the largest margin the outage limit would allow?
Check
A sensor node sleeps at 0.002 mA. Every 10 s it wakes for 100 ms at 2 mA, then transmits for 5 ms at 30 mA. It runs from 220 mAh.
(a)
What is the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How long does the battery last?
Check
A linear regulator drops 5 V to 3.3 V for a load of 0.05 mA, and draws 100 µA of its own (quiescent) current.
(a)
What does it dissipate from the load current?
Write units the way you normally would: 1.5 mW, 1500 µW and 0.0015 W are the same answer.
(b)
What is its efficiency?
Check
A task needs 100000 cycles. Active current is 0.3 mA plus 0.3 mA per MHz of clock, and the board can run at 2 or 10 MHz from 3.3 V.
(a)
What energy does the task take at 2 MHz?
Write units the way you normally would: 1.5 µJ, 1500 nJ and 0.0015 mJ are the same answer.
(b)
And at 10 MHz?
Check
A coin cell at 2.9 V has 20 Ω of internal resistance; a radio burst draws 10 mA, and the board resets below 2.6 V.
(a)
What voltage does the board see during the burst?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What is the largest burst current that avoids a reset?
Check
A supercapacitor of 1 F charged to 3.3 V keeps a clock and RAM alive at 0.01 mA until the voltage falls to 2.4 V.
(a)
How long does it last (constant current)?
(b)
How much energy does it give up?
Write units the way you normally would: 1.5 J, 1500 mJ and 0.0015 kJ are the same answer.
Check
A device logs 64-byte records 24 times a day across 4 flash sectors of 2048 bytes, each rated for 10000 erases.
(a)
How long does one lap of the log take?
(b)
How long until the flash wears out?
Check
A firmware bug resets a device 5 times a day, and each reset writes a crash record by erasing and rewriting one fixed sector rated for 10000 erases.
(a)
How long until that sector wears out?
(b)
And if 32-byte crash records are appended to a 4 KB log in the same sector instead?
Check
A plant of gain 2 and time constant 10 ms is sampled every 0.5 ms.
(a)
What is ?
(b)
What is the largest stable proportional gain?
(c)
Above what gain does the response alternate sign each sample?
Check
A loop was designed for 60° of phase margin at a 50 Hz crossover, ignoring sampling. It runs at 2 kHz with 2 samples of total delay.
(a)
How much margin does the delay take?
(b)
What margin is left?
Check
A PI controller stores = 0.42 in Q10 and = 0.0007 in Q20.
(a)
What integer holds ?
(b)
And ?
(c)
How far off is the stored integral gain, in percent?
Check
A heater's PWM is pinned at 100% for 20 s with an error of 200 codes, sampled every 5 ms; each sample adds 0.002 × e to the integrator.
(a)
How much does the integrator wind up without anti-windup?
(b)
How much with conditional integration?
Check
A proportional loop with gain 5 controls a plant of gain 1; then an integrator is added.
(a)
What steady-state error does the proportional loop leave?
(b)
And with the integrator, once settled?
Check
A windowed watchdog must be kicked between 5 and 20 ms after the last kick. A loop kicks once per pass; passes take 15 ms, and once a second a slow job adds 30 ms to one pass.
(a)
Are normal passes inside the window (1 for yes)?
(b)
Is the slow pass inside it too (1 for yes)?
Check
A device must last 1 years on 1000 mAh.
(a)
What average current may it draw?
Write units the way you normally would: 1.5 µA, 1500 nA and 0.0015 mA are the same answer.
(b)
And if 20% of the capacity is lost to self-discharge and cold?
Check
A MicroPython job makes 1000 hardware calls at 40 µs each. How long do they take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A C loop makes 1000 hardware accesses at 5 cycles each, at 10 MHz. How long do they take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A hardware access takes 40 µs in MicroPython and 7 cycles (100 ns each) in C. How many times faster is C?
Check
A chip has 256 KB of flash, and the MicroPython interpreter needs 256 KB. How much flash is left for everything else (negative if it doesn't fit)?
Check
A job runs 10 times a second, awake 0.5 ms per run in MicroPython or 0.05 ms in C, at 2 mA awake. How much more average current does the MicroPython version draw (sleep current aside)?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
A job makes 1000 hardware calls: about 40 µs each in MicroPython, or 10 instructions each in C on the 10 MHz board.
(a)
How long does it take in MicroPython?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How many times faster is the C version?
Check
A sensor job runs 10 times a second and takes 1 ms in MicroPython.
(a)
What share of the time is MicroPython busy?
(b)
Does it fit at all (1 for yes)?
Check
Time for 500 MicroPython hardware calls?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Time for 300 C accesses at 6 cycles?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Speedup of C at 4 cycles per access over 40 µs?
Check
A function makes 4 independent yes-or-no decisions. How many paths does it have?
Check
A function checks 2 separate ranges, and each needs the four boundary tests (lo − 1, lo, hi, hi + 1). How many boundary tests is that?
Check
A state machine has 6 states and 3 events. How many tests cover every transition, including the ones that should do nothing?
Check
A test suite has 1000 tests taking 0.5 ms each. How long does it take to run?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
Tests exercise 45 of a program's branches; 40 branches are never reached. What's the branch coverage?
Check
A state machine has 5 states and 2 events; each test takes 10 ms.
(a)
How many tests cover every state-event pair?
(b)
How long do they take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A function takes a 10-bit unsigned input.
(a)
How many inputs would an exhaustive test try?
(b)
What is the largest input, the one that most often reveals an overflow?
Check
Paths through 5 independent decisions?
Check
Transition tests for 3 states and 2 events?
Check
Coverage with 60 branches hit and 15 missed?
Check
A job makes 50 hardware calls, 10 times a second. In MicroPython each call takes 40 µs; in C each takes 10 instructions. The board draws 2 mA at 3.3 V while awake.
(a)
What average power does the MicroPython version spend awake?
Write units the way you normally would: 1.5 µW, 1500 nW and 0.0015 mW are the same answer.
(b)
How many times less awake time does C need?
Check
A chip has 512 KB of flash and 8 KB of RAM. MicroPython needs about 256 KB of flash and 16 KB of RAM before any program.
(a)
Can it run MicroPython (1 for yes)?
(b)
If so, how much RAM is left for the program and its heap (0 if not)?
Check
A chip with 256 KB of flash keeps a 16 KB bootloader and two equal firmware slots (A and B) for safe updates; 8 KB is reserved for a settings log.
(a)
How large can the firmware image be?
(b)
How long does writing a full image take, at 0.5 ms per 256-byte page plus 30 ms per 4 KB sector erased?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A conversion function takes a 12-bit input; each test on the board takes 5 µs.
(a)
How long would testing every input take?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
How many tests are 0, 1, the two values around the middle, and the two at the top?
Check
An intermittent bug shows up in each test run with probability 0.05.
(a)
How many runs give a 0.99 chance of seeing it at least once?
(b)
How many runs does it take on average to see it the first time?
Check
A test checks a Q-format result (with 12 fraction bits) against a floating-point reference after 1 rounding step(s), each off by at most half an LSB.
(a)
What tolerance should the test allow?
(b)
In units of the last bit?
Check
An ISR's cycle budget is 300 cycles, and the team wants 10% margin. A test measures it at 700 cycles.
(a)
Does it pass (1 for yes)?
(b)
What is the most it may take?
Check
In a MicroPython program, a fraction 0.8 of the time is spent in one loop, which is rewritten in C and runs 20 times faster.
(a)
What is the whole program's speedup?
(b)
What is the most it could ever gain, however fast the C?
Check
A logger stores 8-byte records 1 times a second in 4 MB of flash.
(a)
How many days does the flash hold?
(b)
Does it hold 365 days without wrapping (1 for yes)?
Check
A sensor event's path: acquisition (0.01 ms), conversion and filtering (0.5 ms), a main loop that may be away for up to 5 ms, and a UART report (2 ms).
(a)
What is the worst-case latency from event to report?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What share of it is the main loop's wait?
Check
A state machine with 4 states and 3 events is tested off the board in a simulation that runs each transition test in 10 µs, against 20 ms each on the board.
(a)
How many transition tests are there?
(b)
How many times faster is the simulation?
Check
A MicroPython program allocates 100 small objects a second; each garbage collection pauses it for 2 ms and happens every 16 KB of allocations, each object taking 32 bytes.
(a)
How often does it collect?
(b)
What jitter does that add to a periodic task?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
100 devices in the field each reset by a rare bug at a rate of 0.5 per 1000 device-hours.
(a)
How many resets happen across the fleet each day?
(b)
What is the chance a single test device shows it within 1000 hours?
Check
A regression suite has 200 tests. On the board each takes 2 s, including flashing and reset; in a simulator each takes 2 ms.
(a)
How long does the suite take on the board?
(b)
And in the simulator?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A battery-powered data logger with 1000 mAh must last a year. It sleeps at 20 µA and is awake at 8 mA for 1% of the time; its sensor draws 100 µA continuously.
(a)
What is its average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
Does it last a year (1 for yes)?
Check
A sampling ISR of 400 cycles runs 100 times a second. What share of the processor does it use?
Check
A logger keeps 10 s of readings at 10 Hz, 4 bytes each. How much RAM does its buffer need?
Check
A report line is 32 characters at 9600 baud. How long does it take to send?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
N = 4 readings in tenths sum to 1007. What does (sum + N/2) / N give, in integer arithmetic?
Check
The logger averages 0.55 mA from a 220 mAh battery. How many days does it run?
Check
Part 2: the readings are below, each plus OFFSET (0). Print their minimum, their maximum and their average rounded to the nearest whole tenth, in integer arithmetic.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
Part 3: send T= and the value W * 10 + D tenths of a degree (7.0) as a decimal number with one decimal place, then a newline.
C on the course's RISC-V board (10 MHz, no floating point). #include "board.h" for the registers; print(x) shows a number. Tab indents; press Esc and then Tab to move on.
Check
Load of a 300-cycle ISR at 20 Hz?
Check
RAM for 30 s at 5 Hz, 2 bytes each?
Check
Rounded average of 8 readings summing to 512?
Check
The room (2000 J/°C, R = 0.02 °C/W, outside 5 °C) is at 18 °C with a 1500 W heater on. How fast is it warming?
Check
A room with R = 0.01 °C/W, outside temperature 0 °C, and a 1500 W heater always on: where does it settle?
Check
A thermostat's band is ±0.5 °C; the room warms at 0.2 °C/s with the heater on and cools at 0.375 °C/s with it off. How long is one cycle?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
What's the time constant of a room with R = 0.02 °C/W and C = 2000 J/°C?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A heater cycles every 5.3 s. About how many times does it switch on in 40 s, once the room is in its band?
Check
The thermostat in MicroPython with the setpoint SP (19 °C) and a ±0.5 °C band; sample every 500 ms.
MicroPython on the course's board: machine (Pin, PWM, ADC, DAC, UART, I2C, SPI, Timer, WDT) and time. Each call into the hardware takes about 40 µs. Tab indents; press Esc and then Tab to move on.
Check
Warming rate: 1200 W, 19 °C inside, 8 °C outside, R 0.02, C 2000?
Check
Settled temperature with 800 W always on, R 0.03, outside 2 °C?
Check
Cycle time: band ±0.3, warming 0.3, cooling 0.2 °C/s?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A job makes 200 hardware accesses.
(a)
How long in MicroPython (40 µs each)?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
And in C at 6 cycles each?
Check
A chip has 512 KB of flash and 32 KB of RAM; MicroPython needs about 256 KB of flash and 16 KB of RAM.
(a)
How much flash is left for the application?
(b)
And how much RAM, beyond the minimum?
Check
A function has 6 independent decisions; a state machine has 4 states and 5 events.
(a)
How many paths through the function?
(b)
How many transition tests for the machine?
Check
A logger samples at 10 Hz with a 400-cycle ISR and keeps 60 s of 2-byte readings.
(a)
What share of the processor does sampling use?
(b)
How much RAM does its buffer need?
Check
10 readings in tenths of a degree sum to 2337.
(a)
What's the rounded average, in tenths?
(b)
What digit is printed after the decimal point?
Check
A room (4000 J/°C, R = 0.02 °C/W, outside 0 °C) is at 21 °C with a 1500 W heater.
(a)
How fast does it warm with the heater on?
(b)
How fast does it cool with the heater off?
Check
A thermostat's band is ±0.5 °C; the room warms at 0.2 and cools at 0.3 °C/s.
(a)
How long is a cycle?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
(b)
About how many times does the heater switch on in 600 s?
Check
A device is awake 0.1% of the time at 2 mA and asleep at 0.05 mA, from 2000 mAh.
(a)
What's its average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How many days does the battery last?
Check
A report of 25 characters goes out at 9600 baud every 5 s.
(a)
How long does each report take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What fraction of the time is the UART sending?
Check
A sampling timer has PRESCALE = 9999 and TOP = 99; each sample's I²C read is 4 bytes at 100 kHz plus two clocks.
(a)
How often does it sample?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
How long is each read on the bus?
Check
A main loop's longest pass is 10 ms; its watchdog gets a 3× margin. A bug hangs it 800 ms after each start.
(a)
What WDT_LOAD?
(b)
How many resets in 10 s?
Check
A task runs 20 times a second: 0.5 ms in MicroPython or 0.05 ms in C, at 2 mA awake.
(a)
What does the MicroPython version add to the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How much does the C version save?
Check
A heater-controlled plant (gain 1, τ = 20 s) is sampled every 1 s under proportional gain 8.
(a)
Where is the closed-loop pole?
(b)
What steady-state error does it leave?
Check
A logger sleeps at 0.003 mA and wakes every 60 s for 100 ms at 2 mA, from 220 mAh.
(a)
What is the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
How many years does it last?
Check
A PI controller's proportional gain 0.6 is stored in Q8; the error is 333 codes.
(a)
What does the proportional term compute?
(b)
How far is that from the exact ?
Check
An LED with forward voltage 1.9 V is driven from 3.3 V through 100 Ω, with PWM at 60% duty.
(a)
What current flows while it's on?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
(b)
What's its average current?
Check
A register byte holds 6E.
(a)
What does it hold after setting bit 2, in hex?
(b)
What's its upper 4-bit field, in hex?
Check
A 22 kΩ pull-up charges 40 pF; separately, a button bouncing 4 times each way is pressed 6 times.
(a)
How long until a released pin reads high? (kΩ × pF = ns)
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
(b)
How many falling edges does an undebounced counter see?
Check
A timer has PRESCALE = 99, TOP = 999; separately, an ISR of 900 cycles fires 50 thousand times a second.
(a)
How long between wraps?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What share of the processor does the ISR use?
Check
A thermistor divider (10 kΩ at 25 °C, B = 3950, over 10 kΩ) gives 1.8 V.
(a)
What code does the 12-bit ADC report?
(b)
What temperature is it?
Check
A value 2.75 is stored with 10 fraction bits; separately, the ADC reads 3707.
(a)
What integer stores 2.75?
(b)
What does (c * 3300 + 2047) / 4095 give?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
A buzzer plays MIDI note 66; separately, a DAC plays a 32-sample table at 32000 Hz.
(a)
What PWM PERIOD plays the note?
(b)
What frequency does the table play?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A UART runs at 115200 baud.
(a)
What BAUDDIV?
(b)
How long do 30 bytes take?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
Bytes arrive at 115200 baud while the main loop may be away for 4 ms; its ring buffer has head 140 and tail 100.
(a)
How many bytes can arrive meanwhile?
(b)
How many bytes are waiting now?
Check
An I²C device answers at 50; a transaction sends 6 bytes at 100 kHz, plus about two clocks.
(a)
What's the first byte of a read, in hex?
(b)
How long does the transaction take?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
An SPI bus (clock ) updates 2 chained shift registers; separately, a frame's payload is 180, 150, 70.
(a)
How long does one update take on the wire?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
What's the payload's 8-bit sum checksum?
Check
A superloop runs task 1 (0.4 ms every 5 ms) and task 2 (40 ms every 1000 ms).
(a)
What's the utilization?
(b)
How late can task 1 start, at worst, because of task 2?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A 100 Hz, 1 V signal is sampled with 40 µs of jitter; separately, a job has latency 90 µs, execution 100 µs and deadline 200 µs.
(a)
How large can a sample's error be?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
(b)
What's the job's margin?
Check
A watchdog gets a 3× margin over an 8 ms longest pass; separately, a device is awake 5% of the time at 2 mA and asleep at 0.5 mA.
(a)
What WDT_LOAD?
(b)
What's the average current?
Write units the way you normally would: 1.5 mA, 1500 µA and 0.0015 A are the same answer.
Check
A room (2000 J/°C, R = 0.02 °C/W, outside 0 °C) has a 1000 W heater; its thermostat's band is ±1 °C, warming and cooling at 0.3 and 0.3 °C/s.
(a)
Where would it settle with the heater always on?
(b)
How long is one on-off cycle?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A device logs 64-byte records 24 times a day in a 4 KB flash sector rated for 10000 erases. Its control loop samples every 5 ms against a plant with a 20 ms time constant.
(a)
How long does the log's sector last?
(b)
What is the loop's largest stable proportional gain (plant gain 1)?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to C12