Chapter 8: Writing I2C Device Drivers
I2C stands for Inter-Integrated Circuit. It is a serial, multi-master, and asynchronous bus invented by Philips (now NXP), though multi-master mode is not widely used. I2C is a two-wire bus, respectively named Serial Data (SDA) and Serial Clock (SCL, or SCK). An I2C device is a chip that interacts with another device via an I2C bus. On this bus, both SDA and SCL are open-drain/open collectors, meaning that each can drive its output low, but neither can drive its output high without having pull-up resistors. SCL is generated by the master to synchronize data (carried by SDA) transfer over the bus. Both the slave and master can send data (not at the same time, of course), thus making SDA a bidirectional line. That said, the SCL signal is also bidirectional since the slave can stretch the clock by keeping the SCL line low. The bus is controlled by the master, which in our case is part of the System on Chip (SoC). This bus is frequently used in embedded...