The bus state logic continuously monitors the activity on the TWI bus when the host is enabled. It continues to operate in all sleep modes, including Power-Down.
The bus state logic includes Start and Stop condition detectors, collision detection, inactive bus time-out detection, and a bit counter. These are used to determine the bus state. The software can get the current bus state by reading the Bus State (BUSSTATE) bit field in the Host Status (TWIn.MSTATUS) register.
The bus state can be Unknown, Idle, Busy or Owner, and it is determined according to the state diagram shown below.
0x1
to the Bus State
(BUSSTATE) bit field. The bus state logic cannot be forced into any other state. If no
state is set by the application software, the bus state will become Idle when the first
Stop condition is detected. If the Inactive Bus Time-Out (TIMEOUT) bit field from the
Host Control A (TWIn.MCTRLA) register is configured to a nonzero value, the bus state
will change to Idle on the occurrence of a time-out. When the bus is Idle, it is ready
for a new transaction.