The FSI module comes with a 16-bit or 32-bit ECC computation module in both the transmitter and receiver. Use of this module is optional.
Note that the ECC is independent and unrelated to the hardware CRC computation module present in both the transmitter and receiver cores.
The following example shows a scenario in which the application requires ECC be calculated and transmitted on a 2-word data frame.
In the FSITX module:
- Configure the ECC module for 32-bit data by setting TX_OPER_CTRL_HI_ALT1_.ECC_SEL to 1.
- Write the data to the TX_ECC_DATA register as well as the transmit buffer.
- Read TX_ECC_VAL Register. This register contains the 8-bit ECC value calculated on the data.
- Copy the 8-bit data from TX_ECC_VAL to TX_FRAME_TAG_UDATA.USER_DATA.
- Set the Start Condition to begin the transmission.
The reverse process is followed on the FSIRX module. Once the data frame is received, user software can do the following:
- Copy the data from the receive buffer to the RX_ECC_DATA register.
- Copy the received user data that contains the transmitted ECC value from RX_FRAME_TAG_UDATA.USER_DATA to the RX_ECC_VAL register.
- Read the RX_ECC_LOG register. This contains the result of the ECC computation using the RX_ECC_DATA and RX_ECC_VAL registers.
- If no ECC errors were detected, RX_ECC_LOG is 0. The correct data is available in RX_ECC_SEC_DATA.
- If a single bit error was detected, RX_ECC_LOG.SBE is 1. The autocorrected data is available in RX_ECC_SEC_DATA.
- If multiple bit errors occurred, RX_ECC_LOG.MBE is 1. The data in RX_ECC_SEC_DATA is invalid and must not be used.
Using a 2-word data frame plus using the user data for the ECC is one possible implementation for ECC detection. Another option is to use a larger data frame a allocate one of the data words to be the ECC value.