Need help understanding HAL I2C operation
I am attempting to transmit four bytes via I2C to a device with address 0x27, using the code below.
data_t[0] = 0x01;
data_t[1] = 0x02;
data_t[2] = 0x04;
data_t[3] = 0x08;
HAL_I2C_Master_Transmit (&hi2c4, 0x27U,(uint8_t *) data_t, 4, 100);My understanding is that the structure of an I2C message is
7 bit addr | R/W bit = 0 (for write) | Data
The address is 0x27 = 0b0100111
The RW bit is 0 for W
So the header byte is then 0b01001110 = 0x4E
So I would expect one of two possible things to happen when I use this command. Either
- Each byte is separate and preceded by the address byte. Then 8 bytes will be clocked out to the I2C bus
[0x4E],[0x01],[0x4E],[0x02],[0x4E],[0x04],[0x4E],[0x08]
- Or there is one address byte, followed by 4 bytes of data. Then 5 bytes will be clocked out
[0x4E],[0x01],[0x02],[0x04],[0x08]
What I actually see on the logic analyser below. So there is 5 bytes, which is something I would have expected, but it seems to be just repeating the address each time, and never actually writing the data.

If anyone could offer any insight on what is going wrong here, it would be appreciated.
