Skip to content

Firmware Fundamentals — question 10 of 10

Write a real answer. It is graded against the question's rubric, and the mastery movement is computed by the same engine the product uses. Scoring here is deterministic rather than model-written, so this page costs nothing to run and nothing is saved. In a track built from your own posting, the same rubric is graded by the model, which is what produces feedback about your reasoning rather than about coverage.

The struct is `struct { uint16_t x, y, z; } sensor;` updated field-by-field inside the timer ISR every 1ms, and read field-by-field in the main loop's copy routine.

A board has two interrupt handlers at different priority levels: a high-priority 1kHz timer ISR that updates a 3-field struct of 16-bit sensor axes (x, y, z), and a lower-priority UART ISR that can preempt the main loop but never the timer ISR. The main loop periodically copies the whole struct out to send over UART. Occasionally the transmitted x, y, z values look like they came from different, inconsistent moments in time even though there's no crash and no obvious data corruption otherwise. Walk through why this happens and how you'd fix it, given that disabling interrupts for the entire multi-field copy is not acceptable because it would blow the timer ISR's real-time budget.

How sure are you?

Being confidently wrong costs more mastery than admitting a guess — that is deliberate, and it is how misconceptions get found.

Neither is graded, and nothing here is recorded.