Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: (?) RasPi (MS) and ATtiny85 (SL) via i2c - Sketch runs once then behaves strange on: January 04, 2013, 08:00:24 pm
I think there is a bug in usiTwlSlave.c when buffer underruns occur. Specifically, if this bit of code is ever reached, its game over:
      {
        // the buffer is empty
        SET_USI_TO_TWI_START_CONDITION_MODE( );
        return;
      } // end if
The fix is to change SET_USI_TO_TWI_START_CONDITION_MODE to set SDA as an input rather than leaving it as a output in the buffer underrun case:
#define SET_USI_TO_TWI_START_CONDITION_MODE( ) \
{ \
  /* set SDA as input */ \
  DDR_USI &= ~( 1 << PORT_USI_SDA ); \
  USICR = \
I was seeing the issue you were seeing today until I did this.
Pages: [1]