Afterthought

I2C Stops After One Read Debug

Symptom

Since humidity was added, the board prints the TEMP line and then nothing. The registers and bit fields are on the Datasheet tab.

Circuit

Block diagram: U1, an STM32F4, drives SCL on PB6 and SDA on PB7 to U2, a temperature and humidity sensor at address 0x48, with pull-ups R1 and R2 to 3V3 and TP1, a logic analyzer, on both lines; PA9 carries USART1 TX to J1, a serial console

Pass condition

Once after reset, USART1 prints TEMP:<t> then HUM:<h>, the bytes in the sensor's registers 0x00 and 0x01 in decimal, each from its own read.

Expected output for the case with temperature 27 and humidity 58: on the sensor bus two reads, each a write of the register address to 0x48 and one byte back, 00 then 1B and 01 then 3A; then the lines TEMP colon 27 and HUM colon 58 on the serial console

Notes

From power-up the bench plays U2 at 0x48. Each of U2's registers is one byte. Only I2C1 needs its clock enabled on this bench, and the program does that.

Related challenges

Loading the interactive arena.