Reading / writing from using I2C on Linux

前端 未结 4 1161
死守一世寂寞
死守一世寂寞 2021-01-01 22:58

I\'m trying to read/write to a FM24CL64-GTR FRAM chip that is connected over a I2C bus on address 0b 1010 011.

When I\'m trying to write 3

4条回答
  •  再見小時候
    2021-01-01 23:43

    Note that the method using the struct i2c_rdwr_ioctl_data and the struct i2c_msg (that is, the last code part you've given) is more efficient than the other ones, since with that method you execute the repeated start feature of I2c.

    This means you avoid a STA-WRITE-STO -> STA-READ-...-STO transition, because your communication will become STA-WRITE-RS-READ-...STO (RS = repeated start). So, saves you a redundant STO-STA transient.

    Not that it differs a lot in time, but if it's not needed, why losing on it...

    Just my 2 ct.

    Best rgds,

提交回复
热议问题