Cascade

SPI Two Devices on One Bus Debug

Symptom

Each boot prints the right temperature, then WHOAMI:0xFF. Alone, the accelerometer answered. The registers and bit fields are on the Datasheet tab.

Circuit

Bench wiring: U1, an STM32F4, reaches the temperature sensor U2 at address 0x48 over I2C1 on PB6 and PB7, the accelerometer U3 over SPI1 with chip select on PA4 and SCK, MISO and MOSI on PA5 to PA7, the serial console J1 on PA9, and the debug header J2 on PA13 to PA15

Pass condition

Once after reset, USART1 prints TEMP:<celsius> then WHOAMI:0x<id>, as the sensors report them. A debug probe on J2 can still attach after boot.

Expected output for the room-temperature case: the serial console prints TEMP colon 26 then WHOAMI colon 0x68, and the SPI bus carries one frame while chip select is low, the master sending F5 then 00 and the accelerometer answering FF then 68

Notes

The bench plays the two sensors from power-up. MISO's pull-up makes an unanswered read 0xFF. Only I2C1 needs its clock enabled on this bench, and the program does that. USART1 at 9600 baud: BRR = 0x683

Related challenges

Loading the interactive arena.