Author Topic: TWI - why no stop sometimes  (Read 998 times)

0 Members and 1 Guest are viewing this topic.

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2203
TWI - why no stop sometimes
« on: April 13, 2018, 11:26:36 pm »
I've got a couple of AVR's using their TWI interface to talk to each other.

ISSUE # 1 - In TWI1.png below, it has a stop/start, but in TWI2.png below, I did not get the stop?  It is the same code run again and again.

Code: [Select]
      case TWI_MTX_ADR_ACK: //0x18
      case TWI_MTX_DATA_ACK: //0x28
        //do we have more to send?
        if (TWIPos<PROTOCOL_SIZE)
          {
            //yes, transmit byte
            TWDR=RxBuffer[TWIPos++];
            TWCR=_BV(TWEN) | _BV(TWIE) | _BV(TWINT);
          }
        else
          {
            //send stop
            TWCR=_BV(TWEN) | _BV(TWINT) | _BV(TWSTO);
            TWIState=TWISTATE_SENT;
          }
        break;

ISSUE # 2 - Also in TWI1.png I put a square around a glitch that shows up in many of the bytes sent to the slave.  I don't think it affects anything, but is this when one device is turning off and allowing the other to ack/nak it?  I see this tiny little glitch on many of the tx bytes.  Actually it is on the RX bytes too.  Happens during the fall of the clock though and I only think it is sampled on the rise.
« Last Edit: April 13, 2018, 11:28:21 pm by alank2 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf