felias-fogg / SoftI2CMaster

Software I2C Arduino library
GNU General Public License v3.0
368 stars 100 forks source link

Will any interrupts influence SoftI2CMaster? #28

Closed bukatea closed 6 years ago

bukatea commented 6 years ago

Hello,

I realize that this is not so much of an issue than a question, but I hope you'll forgive me for asking it here as this is the most reliable place to get answers about this specific library.

Anyways, will interrupts influence SoftI2CMaster's function execution at all during communications? This property is imperative to my current project. For example, if I enable interrupts using sei() in setup, then start I2C communications, will the presence of an interrupt request disrupt the communication? Specifically, if an external interrupt INT0 is triggered (say, on an ATtiny84a) during i2c_write or something, will the communications be messed up as a result? How about if a timer goes off?

Thanks so much!

felias-fogg commented 6 years ago

Hi,

interrupts can lead to the the fact that the clock signal can get stretched. This leads to some jitter of the I2C clock signal. However, that is not a problem for any I2C slave, because they follow the clock signal to the dot. What I have seen is that the protocol analyzers of scopes and logic analyzers may get confused when the I2C clock signal get stretched, but this is a different story.