SLAU847F October 2022 – March 2026 MSPM0L1105 , MSPM0L1106 , MSPM0L1116 , MSPM0L1117 , MSPM0L1227 , MSPM0L1227-Q1 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2116 , MSPM0L2117 , MSPM0L2227 , MSPM0L2227-Q1 , MSPM0L2228 , MSPM0L2228-Q1
PEC is a CRC-8 error checking byte which is calculated using all the message bytes of a transaction, including addresses and read/write bits. The ACK/NACK, START, and STOP bits do not contribute to the PEC calculation. The PEC is appended to the message by the device that supplied the last data byte. PEC is cleared upon STOP condition in controller mode, and is cleared upon NACK in target mode.
The PEC Polynomial calculation is the below.
The PECCTL register on Advanced UNICOMM-I2CC and UNICOMM-I2CT instances supports PEC transmission and checking for both controller and target modes. Each of the fields from the PECCTL register are described below.
For transmitting, an extra byte needs to be inserted into the transmit sequence for each transaction by writing a dummy byte to the TXDATA register. If PECEN is set, I2CC/I2CT calculates the PEC and replaces this dummy byte with the PEC value during transmission when the data byte count reaches the value in PECCNT. For reception, a PEC byte is received the same as a data byte through the RX FIFO. If PECEN is set and the data byte count is equal to the value programmed in PECCNT, the I2CC/I2CT checks the next received byte since that is the PEC. If the PEC byte is non-zero, the PEC_RX_ERR flag in RIS is set and a NACK is transmitted on the line automatically.
The PECSR register is also added to provide status flags relating to PEC operation and functionality for both UNICOMM-I2CC and UNICOMM-I2CT. Each of the fields from the PECSR register are described below.
In a typical I2C Target use case, software can set PECEN=1 and PECCNT=0 and enabled the manual ACK override feature, by setting the ACKOEN bit, until the remaining packet length is known. Software then can set the PECCNT to the remaining packet length (including the PEC byte). Once transmission/reception of the packet is complete, manual ACK override mode can be disabled by clearing ACKOEN.