Flight Recorder

SPI Control Register Exercise

Task

Once after reset, set RUN, bit 3 of U2's CTRL register (0x2D), and leave CTRL's other bits as they are. Print CTRL as U2 reads it back. The registers and bit fields are on the Datasheet tab.

Circuit

Block diagram: U1 STM32F4 wired to U2, the recorder's sensor: PA4 to CS with R1 pulling it up to +3V3, PA5 to SCK, PA6 from SDO, PA7 to SDI, and PA9 carrying the USART1 report to TP1, a serial monitor

Pass condition

The logic analyzer must show only the commands the task needs, each in its own CS frame. The terminal must print CTRL:0x and the byte CTRL then has, in two hex digits.

Expected output: chip select goes low three times, once per command, and the terminal prints CTRL:0x followed by the value U2's CTRL holds at the end

Notes

U2 is the bench's sensor. A frame starts with the register byte, bit 7 set to read. Send 0x00 where a byte has no data. Your program is built and run at -O0, then at -O2. Both must pass.

Related challenges

Loading the interactive arena.