2021-07-24 01:42 PM
I have to write code to write/read to/from an ATMEL 24C256 EEPROM which has a 7-bit address and the eighth bit is for R/W. I guess the MCU should be configured for 7-bit addressing (ADD10 = 0) but in this case how does the MCU write the eighth (R/W) bit?
Solved! Go to Solution.
2021-07-24 06:05 PM
The STM32 expects the slave address in the upper 7-bit. You might need to use (slaveaddr << 1)
Check the bit patterns in your I2C data sheet. 0110000 would be (0x30 << 1)
The low order read/write bit is set by the I2C peripheral of the STM32 based on direction of transaction
2021-07-24 02:05 PM
That's how I2C normally works. The first byte sent out is comprised of the 7-bit address plus the R/W bit. In HAL, the R/W bit is automatically set based on if the function reads or writes to I2C.
2021-07-24 06:05 PM
The STM32 expects the slave address in the upper 7-bit. You might need to use (slaveaddr << 1)
Check the bit patterns in your I2C data sheet. 0110000 would be (0x30 << 1)
The low order read/write bit is set by the I2C peripheral of the STM32 based on direction of transaction