I have been trying to practise writing drivers using the I2C protocol and as a result, I have checked the drivers written for the BMP180 temperature sensor by Adafruit and written my own some time ago while making some changes and tinkering. The BMP180 is addressed by Adafruit, by using a 7-bit slave address "0x77". I have used this slave address to read and write in the same way i.e. To write to the device:
HAL_I2C_Master_Transmit(i2c, (BMP180_I2C_ADDR << 1), &data, 2, 1000);
where "data" will be the data I transmit. I have used HAL_I2C_Master_Receive
to read from the device. The above method worked fine, where Master_Transmit
and Master_Receive
was used.
However, given the datasheet of the sensor on page 20, the read-address is "0xEF" and the write address is "0xEE". I had taken the device address as "0x77" for granted. However, now I cannot understand how one derives the "0x77" from "0xEE" or "0xEF". I am trying to replicate the drivers, using HAL_I2C_Mem_Read
and HAL_I2C_Mem_Write
.