Master Write Mode

Master Write Mode means that the master is going to transmit data to the slave. The USI is set up to sample a byte on the data line.

When the byte has been shifted in successfully, the slave sends an ACK to the master. After storing the data in the buffer, and setting up USI to sample the next byte, the application waits for one USI clock to test if there has been sent a STOP condition from the master. If there is a STOP condition, the receive buffer is tagged as full. And the interface is reset. If not then the transmission is continued.

Figure 1. Flowchart of the Processes in the USI Overflow Interrupt. Data Buffer Handling is not Included Here. The Interrupt is Initially Called after Eight Bits are Sampled.

These actions will terminate and reset any transmission:

Optionally one can also add more buffer control and the same response if the master requests/sends more information then the size of the transmit/receive buffers. This buffer control can be enabled by setting a define in the driver header file.