I am trying to use the USI on a ATmega165p in I2C slave mode. I grabbed the USI slave code for the AVR312 appnote and I am having problems with it.
Everything works fine if I disable the counter overflow hold on SCL when transfering data from slave to master. However, enabling counter-overflow hold causes my master I2C driver to skip bits (it uses the linux bit-bang I2C algorithm). See table 19-1 in the atmega165p for some detail.
The code in AVR312 I had to modify to get things to work is the start condition ISR - I set USIWM0 to 0 instead of 1.
Has anybody else seen a problem like this? Any idea what might be wrong?