An SPIM transaction is started by triggering the START task. This initiates a number of bytes to be transmitted/received on SDO/SDI.
The following figure illustrates an SPIM transaction.
The ENDTX event is generated when all bytes in buffer DMA.TX.PTR are transmitted. The number of bytes in the transmit buffer is specified in register DMA.TX.MAXCNT. The ENDRX event is generated when buffer DMA.RX.PTR is full; that is when the number of bytes specified in register DMA.RX.MAXCNT have been received. The transaction stops automatically after all bytes are transmitted or received. When the maximum number of bytes in the receive buffer is larger than the number of bytes in the transmit buffer, the contents of register ORC will be transmitted after the last byte in the transmit buffer has been transmitted.
The END event is generated after both the ENDRX and ENDTX events have been generated.
SPIM is stopped by triggering the STOP task. If the STOP task is triggered during an ongoing transaction, SPIM completes the process for the current byte before stopping, and a STOPPED event is generated. The STOPPED event is only generated when the SPIM has an ongoing transaction at the time the STOP task is triggered.
If the ENDTX event has not been generated when the SPIM peripheral stops, the ENDTX event will be generated, even if all bytes in the buffer have not been transmitted.
If the ENDRX event has not been generated when the SPIM stops, the ENDRX event will be generated even if the buffer DMA.RX.PTR is not full.
A transaction can be suspended and resumed using the SUSPEND and RESUME tasks, respectively. When the SUSPEND task is triggered, SPIM completes transmitting and receiving the current byte before it is suspended.