cancel
Showing results for 
Search instead for 
Did you mean: 

To read a word via I2C I need to add a second start condition to the procedure. What would be the easiest way to accomplish this?

RCooke88
Senior

From the datasheet from the slave device: "First the host must write a command to the slave device. Then it must follow that command with a repeated start condition to denote a read from that device's address. The slave then returns two bytes of data.

Note that there is not a stop condition before the repeated start condition, and that a "Not Acknowledge" signifies the end of the read transfer."

The data format:

S - Device Addr - Wr - A Cmd Code - A - S - Device Addr - Rd - A - Data Byte Low - A - Data High - !A - P

The Slave's responses are underlined.

Any ideas?

Thanks,

Richard

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
KnarfB
Principal III
gbm
Lead III

Simple: use HAL_I2C_MemoryRead().

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
RCooke88
Senior

Thanks. I think that will work. Don't understand why I didn't look at that.