C12 Embedded systems in MicroPython and C · Practice
Real-time thinking: latency, jitter and deadlines
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.
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.
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C12