Embedded Systems · Interrupts, concurrency, and shared state
A UART RX FIFO is 16 bytes deep
Problem
A UART RX FIFO is \(16\) bytes deep. An RXFT interrupt is asserted whenever the FIFO fill level is at least the watermark \(W=8\) bytes, and is cleared only by draining the FIFO below \(W\). An IDLE interrupt is asserted when the line has been idle for one character time after at least one byte has been received since the previous idle, and is cleared by reading the UART status and data path as specified below. Character format is 8N1 at \(2.000\,\mathrm{Mbit/s}\) (bit rate \(2.000\,\mathrm{MHz}\)). A burst of \(45\) bytes arrives back-to-back with no idle between them, after which the line is idle for many character times. Each RXFT ISR reads exactly \(8\) bytes from the FIFO (or until empty, whichever first). The IDLE ISR reads every remaining byte until the FIFO is empty. ISR CPU time is \(1.50\,\mu\mathrm{s}\) plus \(0.40\,\mu\mathrm{s}\) per byte read. No overflow occurs unless a part explicitly asks about fill level. (a) Compute the character time in microseconds. Compute the wall-clock duration of the \(45\)-byte burst. (b) Determine the number of RXFT ISR entries and the number of IDLE ISR entries caused by this burst-then-idle pattern. Compute the total number of bytes read in RXFT ISRs and in the IDLE ISR. (c) Compute the total ISR CPU time and the CPU occupancy over the burst interval of (a) (do not include idle time after the burst in the occupancy denominator). (d) Suppose instead that each RXFT ISR is delayed so that it begins only \(40.0\,\mu\mathrm{s}\) after the watermark is first reached, during which the burst continues at full rate. Starting from an empty FIFO, determine the peak FIFO fill level at the first RXFT ISR entry, and decide whether a \(16\)-byte FIFO overflows before that first drain. Repeat for a delay of \(50.0\,\mu\mathrm{s}\).
Hint
Watermark interrupts drain in chunks of \(W\); IDLE is what harvests the leftover after the line goes quiet.
Check your work
Work the problem yourself first. Then open it in Training to check your answer and read the full worked solution.
The answer check and full solution for this problem come with ProofAnvil Practice membership ($19 USD monthly). See membership. Or start with the free Embedded Systems sample problem: Try the free sample problem.
More Embedded Systems practice problems
- GPIOA on Anvil-M0 provides three 32-bit registers that affect the same 16 output…Microcontrollers, memory-mapped I/O, and peripherals
- A 12-bit ADC with V_REF=3.300 V and V_LSB=V_REF/4096 is read sixteen times in…Microcontrollers, memory-mapped I/O, and peripherals
- USART2 is clocked by f_CK=36.00 MHzInterrupts, concurrency, and shared state
- A complementary PWM pair drives one leg of an H-bridgeTimers, scheduling, and real-time constraints
- Two 16-bit timers are cascaded to form a 32-bit timestampTimers, scheduling, and real-time constraints
- A brushless-DC commutation computer runs two independent implicit-deadline periodic…Serial buses and communication protocols
- A single fully preemptive uniprocessor hosts three independent implicit-deadline…Serial buses and communication protocols
- Standard-mode I^2C requires t_LOW≥ 4.70 μs and t_HIGH≥ 4.00 μs on SCL, t_r≤ 1.00 μs…Memory, energy, and reliability budgets
- A two-door airlock is modelled by Boolean variables L and R, each 1 when that door is…State-machine verification and safety boundaries