42.7.5.6.1 Packet Error Checking

Each SMBus transfer can optionally end with a CRC byte, called the PEC byte. Writing a one to TWIHS_CR.PECEN will send/check the PEC field in the current transfer. The PEC generator is always updated on every bit transmitted or received, so that PEC handling on the following linked transfers is correct.

In Client Receiver mode, the Host calculates a PEC value and transmits it to the Client after all data bytes have been transmitted. Upon reception of this PEC byte, the Client compares it to the PEC value it has computed itself. If the values match, the data was received correctly, and the Client returns an ACK to the Host. If the PEC values differ, data was corrupted, and the Client returns a NACK value. TWIHS_SR.PECERR is set automatically if a PEC error occurred.

In Client Transmitter mode, the Client calculates a PEC value and transmits it to the Host after all data bytes have been transmitted. Upon reception of this PEC byte, the Host compares it to the PEC value it has computed itself. If the values match, the data was received correctly. If the PEC values differ, data was corrupted, and the Host must take appropriate action.

See Client Read Write Flowcharts for detailed flowcharts.