We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I try to use hardware i2c on XC161CJ with TimeKeeper M41T56. As examle, take source code from C161 manual, but there are some trouble. May be, some of fachmans have little succesfull example of hw i2c ?
"I think, the reason is in my poor understanding of hardware i2c work." If changing optimisation levels breaks your code, it could be your understanding of optimisation? Have you been sure to use the 'volatile' keyword where necessary? Are you relying upon 'C' software loops for timing? Did the C161 User Manual make any specific mention of optimisation? Or any other restrictions/limitations/warnings?
Thanks, Andy, for your advices. They force me to explore this question more accurate. I find out, that at max speed ( 40MHz CPU, all timings of external memory = 0 ), some delays between operation with i2c registers are critical. I don't like _nop_s at all, but in this case they are really needed. If you wish, I can prepare little project to demonstrate my exploring. My mail is ( divided to avoid spam-amateur ) larry_ @ aport2000 . ru Best wishes, Valery