- This topic has 4 replies, 2 voices, and was last updated 7 years, 10 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
Home › Forums › Mastering STM32 book support forum › Ch14 I2C R/W bit
Hi,
I am confused the book mention that the LSB bit of the slave address must be set to 1 for read and 0 for write operation but the code sample calls
Write_To_24LCxx(&hi2c1, 0xA0, 0x1AAA, (uint8_t*)wmsg, strlen(wmsg)+1);
Read_From_24LCxx(&hi2c1, 0xA0, 0x1AAA, (uint8_t*)rmsg, strlen(wmsg)+1);
So twice the same address.
I do not understand where the R/W bit is changed.
Could you help to clarify this please?
Thanks
That bit is set internally by the HAL.
Ok Thanks.
If I debug step by step I should be able to find where in the HAL it is done. Correct?
See to the way the I2C_TransferConfig() is called inside the HAL_I2C_Master_Receive().
Found it thanks 😉
hi2c->Instance->DR = I2C_7BIT_ADD_WRITE(DevAddress);