3 A Software Implementation of the I2C Bus

Although the vast majority of widely used I2C functionality comes as part of a peripheral IC or a CPU on an SBC, occasionally you may need to develop firmware for hardware that does not provide I2C support. In that case, you’ll have to implement the I2C protocol in software.

This chapter shows how to implement both controller and peripheral devices using nothing more than GPIO pins on a standard microcontroller (MCU). I will use the Teensy 3.2 as an example, though the same principles apply to almost any device with at least two programmable I/O pins. If you want to use this code for some other ...

Get The Book of I2C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.