Other Parts Discussed in Thread: TPS38900X-Q1, , TPS389C03-Q1, TPS38800-Q1, TPS389R0-Q1, TPS388R0-Q1
Tool/software:
How is the PEC Byte calculated? Is there a tool to assist in the calculation.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
How is the PEC Byte calculated? Is there a tool to assist in the calculation.
Hello,
Packet Error Checking (PEC) is a way to implement Cyclic Redundancy Checking (CRC). PEC is a dynamic CRC that happens only during read or write transactions if enabled. With the initial value of CRC set to 0x00, the PEC uses a CRC-8 represented by the polynomial:
C (x) = x 8 + x 2 + x + 1
The polynomial is meant to catch any bit flips or noise in I2C communication which cause data and PEC byte to have a mismatch. The PEC calculation includes all bytes in the transmission, including address, command and data. The PEC calculation does not include ACK or NACK bits or START, STOP or REPEATED START conditions. If PEC is enabled, the TPS38900x-Q1 is responsible for sending the PEC byte during a read transaction. If PEC is enabled, and the MCU is responsible for sending the PEC byte during a write transaction.
The PEC can be calculated using the PEC calculator located on the TPS38900x product page. For example, say that the user would like to access register Bank One of the device. To access register Bank One the user must write a value of 1 to the Register Bank bit located at address 0xF0, as defined in the datasheet. To calculate the PEC for this transaction the user would need to provide the three pieces of information Device ID, Register Address, and Data. In this example that would be 0x30, 0xF0, and 0x01 respectively.
Based on the information provided the corresponding PEC byte will be calculated. The calculated “WRITE_PEC” byte is the byte of information which should be written the end of the I2C transaction for it to be accepted as a valid transaction.
**Above statement is valid for other members of the TPS38900x family including: TPS389006-Q1, TPS389C03-Q1, TPS38800-Q1, TPS389R0-Q1, TPS388R0-Q1**
Regards,
Oscar Ambriz