Hi,
We based our I2C controller on the i2c_ex2_eeprom example. However, instead of using interrupts we use the I2C_getInterruptSource call in a polling loop to detect when a stop condition has happened and then before issuing the next read or write use the I2C_getStopConditionStatus and the I2C_isBusBusy calls to make sure the bus is ready.
When the Code has optimizations off everything works great. When the code has register optimizations turned on, it looks like we have a missing stop condition intermittently. I don't have a problem leaving optimizations off for this particular code but need to understand why to be sure it simply mask a real problem.
I see now that you have newer examples ex4 and ex6 for I2C / EEPROM and in may posts you are suggesting people use these new examples. However they look very different and would be a total re-write of our I2C controller. Is there a known issue with using the ex2 example method? If so, does it make sense that it works with optimizations off but not on?
There are at least two proper ways, I can see to resolve the situation.
1) I confirm that leaving optimizations off in the ex2 code actually guarentees proper operation and is not just masking a nasty bug that will hurt us later.
2) We re-write the I2C code to follow your new examples, which is extensive work. In this case, I will need to have some justification to management why the rewrite is needed.
Any thoughts and Happy holidays,
Jennifer