This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Have some troubles with hardware i2c

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 ?

Parents
  • "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?

Reply
  • "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?

Children
  • 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