I was having problems with reliable communications with the lightning detector chip over the I2C bus. Sometimes I would read a register and it would not be at all what I was expecting. The situation was during calibration when I was reading register 8 and suddenly one of the control bits would get set to zero. Since I was only reading this register, having a bit change value was unexpected. And it was not just a read problem because the functionality of that was controlled by the bit changed as well.At first I figured I was not doing the I2C protocol properly. I send hours with a logic analyzer capturing data and going over it. Nothing. And then in a fit of desperation, I modified the bus speed from 100kHz to 50kHz and everything started to work reliably. But why? Why would reading a register at a fast rate cause bits to be changed? I am beginning to suspect this chip has more anomalies that will be revealed over time.
I will be cleaning up the code shortly and will post it here. Perhaps this weekend if I do not get called into work as I have been for the last month.