Hello Dirk,
On Mon, 26 Nov 2007 15:18:24 +0100, you wrote:
>Now the surprise: your code works properly and the address and command
>byte are well received by the slave, as long as the check for a stop
>condition is left as comment as in your original file. However, when
>removing the comment signs and thereby activating the check of a stop
>condition in the wait loops for USI overflow, the
I2C communication is
>always stopped. I watched the signals on osci. I could not find a stop
>condition except at the end of transmission.
>
>Do you have an explanation?
I experienced the same behaviour, but couldn't explain it. The USIPF bit seemed to be permanently set regardless of the bus state. An attempt to clear it by software failed as well. I don't know whether this was a bug in the silicon, or did I misunderstand the datasheet.
>Obviously, you had a reason to comment the check for stop condition and
>not use it in the real code?
It was only a quick fix to make the code work. Eventually I decided to abandon the USI at all, and to do everything in software.
Later I found a similar
I2C slave implementation written by someone else (in the attachment, not tested). Please note that it doesn't check for stop condition, either.
Best regards
Piotr
Lesezeichen