26.3.2.3.1 Receiving Address Packets

When the TWI is configured as a client, it will wait for a Start condition to be detected. When this happens, the successive address packet will be received and checked by the address match logic. The client will ACK a correct address and store the address in the Client Data (TWIn.SDATA) register. If the received address is not a match, the client will not acknowledge or store the address, but wait for a new Start condition.

The Address or Stop Interrupt Flag (APIF) in the Client Status (TWIn.SSTATUS) register is set to ‘1’ when a Start condition is succeeded by one of the following:

  • A valid address match with the address stored in the Address (ADDR[7:1]) bit field in the Client Address (TWIn.SADDR) register
  • The General Call Address (0x00), and the Address (ADDR[0]) bit in the Client Address (TWIn.SADDR) register is set to ‘1
  • A valid address match with the secondary address stored in the Address Mask (ADDRMASK) bit field, and the Address Mask Enable (ADDREN) bit is set to ‘1’ in the Client Address Mask (TWIn.SADDRMASK) register
  • Any address if the Address Recognition Mode (PMEN) bit in the Client Control A (TWIn.SCTRLA) register is set to ‘1

Depending on the Read/Write Direction (DIR) bit in the Client Status (TWIn.SSTATUS) register and the bus condition, one of four distinct cases (S1 to S4) arises after the reception of the address packet.

Figure 26-6. TWI Client Operation