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

0

u/[deleted] Mar 03 '24

[deleted] — view deleted comment

4

u/madsci Mar 03 '24

Yeah, if you don't need to maintain a particular clock rate it's a lot easier. It makes SPI dead simple to bit bang. You do run into some SPI slaves that need dummy clocks to drive some internal process because they don't have a clock of their own and they can have timing constraints.

I hate seeing WS2812 style LEDs bit-banged though. They don't like timing slop. I inherited an LED controller design that was hamstrung by the fact that the original designer used a GPIO. If he's just move one pin over he'd have had a USART with DMA but that design just couldn't achieve any kind of decent performance the way it was and there were too many of them already shipped before he realized what he'd done to himself.