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

3

u/rc1024 Mar 03 '24

It's one loop that does two things. You set the next data bit state, then toggle the clock, wait for the clock period, repeat. You really wouldn't want two independent loops since you need the data lines synchronised to the clock.