- Mon May 25, 2015 11:18 am
#18408
Clock stretching is someting a slave does. Is your implementation creating a slave or a master? A master would sound much more logical. A master does not do clock stretching by definition, because the master supplies the clock. The only requirement for the clock is that it runs at < 100 KHz at any single time. Besides that, it can be as monotonic or non-monotonic as you like, comparable to SPI. Clock is a bit confusing in this context, it's not a wall clock, it's more like a "data is valid NOW" strobe (+ out-of-band conditions like start and stop, but that's a different story altogether).
That means that the timing is really not quite critical, on a master. On a slave it's much more critical, especially if the master doesn't honour clock stretching by the client.
Having said that, I doubt it won't be harmful if you disable interrupts every now and time, as long as you treat the piece of code that runs with interrupts disable just like and interrupt service handler itself; do only what's really necessary and move all other code out of the critical section.