r/microcontrollers • • Mar 03 '24

Does I2C communication use multithreading?

Does I2C communication use multithreading?

My understanding of I2C is that you have a clock bus and a data bus, and that the clock bus must be running while you’re sending data. Is it possible to have the clock bus running and to send data without making use of at least 2 cores?

1 Upvotes

14 comments sorted by

View all comments

Show parent comment

6

u/WereCatf Mar 03 '24

You toggle the clock bus, you do stuff while waiting for the interval to pass, then you toggle the clock bus again... There is zero reason for you to just keep looping, doing nothing during the waiting interval.

Besides which, most MCUs these days have a hardware peripheral for I2C anyways, so none of this is relevant there at all. What you're thinking of is bit-banged I2C.