29.5.12 Client Status
Name: | SSTATUS |
Offset: | 0x0B |
Reset: | 0x00 |
Property: | - |
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
DIF | APIF | CLKHOLD | RXACK | COLL | BUSERR | DIR | AP | ||
Access | R/W | R/W | R | R | R/W | R/W | R | R | |
Reset | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Bit 7 – DIF Data Interrupt Flag
This flag is set to ‘1
’ when the client byte transmit or receive
operation is completed without bus errors. This flag can be set to
‘1
’ with an unsuccessful transaction in case of collision
detection. Find more information in the description of the Collision (COLL) bit.
The DIF flag can generate a client data interrupt. Find more information in the description of the Data Interrupt Enable (DIEN) bit in the Client Control A (TWIn.SCTRLA) register.
This flag automatically clears when some TWI registers are accessed. Any of the following methods can be used to clear the DIF flag:
- Writing/Reading the Client Data (TWIn.SDATA) register.
- Writing to the Command (SCMD) bit field in the Client Control B (TWIn.SCTRLB) register.
Bit 6 – APIF Address or Stop Interrupt Flag
This flag is set to ‘1
’ when the client address has been
received or by a Stop condition.
The APIF flag can generate a client address or stop interrupt. Find more information in the description of the Address or Stop Interrupt Enable (APIEN) bit in the Client Control A (TWIn.SCTRLA) register.
This flag can be cleared using any of the methods described for the DIF flag.
Bit 5 – CLKHOLD Clock Hold
When this bit is read as ‘1
’, it indicates that the client is
currently holding the SCL low, stretching the TWI clock period.
This bit is set to ‘1
’ when an address or data
interrupt occurs. Resetting the corresponding interrupt will indirectly set this
bit to ‘0
’.
Bit 4 – RXACK Received Acknowledge
When this flag is read as ‘0
’, it indicates that the most recent
Acknowledge bit from the host was ACK.
When this flag is read as ‘1
’, it indicates that the most recent
Acknowledge bit from the host was NACK.
Bit 3 – COLL Collision
1
’, it indicates that the client has
not been able to do one of the following:- Transmit high bits on the
SDA. The Data Interrupt Flag (DIF) will be set to ‘
1
’ at the end because of the internal completion of an unsuccessful transaction. - Transmit the NACK bit.
The collision occurs because the client address match already took
place, and the APIF flag is set to ‘
1
’ as a result.
Writing a ‘1
’ to this bit will clear the COLL flag.
The flag is automatically cleared if any Start condition (S/Sr) is detected.
Bit 2 – BUSERR Bus Error
The BUSERR flag indicates that an illegal bus operation has occurred.
Illegal bus operation is detected if a protocol violating the Start (S),
repeated Start (Sr), or Stop (P) conditions is detected on the TWI bus lines. A
Start condition directly followed by a Stop condition is one example of a
protocol violation. Writing a ‘1
’ to this bit will clear the
BUSERR flag.
The TWI bus error detector is part of the TWI host circuitry. For the bus errors
to be detected by the client, the TWI Dual
mode or the TWI host must be enabled, and the main clock frequency must
be at least four times the SCL frequency. The TWI Dual mode can be enabled by writing ‘1
’ to the
ENABLE bit in the TWIn.DUALCTRL register. The TWI host can be enabled
by writing ‘1
’ to the ENABLE bit in the TWIn.MCTRLA
register.
Bit 1 – DIR Read/Write Direction
This bit indicates the current TWI bus direction. The DIR bit reflects the direction bit value from the last address packet received from a host TWI device.
When this bit is read as ‘1
’, it indicates that a host read
operation is in progress.
When this bit is read as ‘0
’, it indicates that a host write
operation is in progress.
Bit 0 – AP Address or Stop
When the TWI client Address or Stop Interrupt Flag (APIF) is set to
‘1
’, this bit determines whether the interrupt is due to an
address detection or a Stop condition.
Value | Name | Description |
---|---|---|
0 | STOP | A Stop condition generated the interrupt on the APIF flag |
1 | ADR | Address detection generated the interrupt on the APIF flag |