SLAA941 March 2020 TUSS4440 , TUSS4470
The parity bit ensures that the total number of 1-bits in the string is even or odd. Accordingly, there are two variants of parity bits: even parity bit and odd parity bit. In the case of even parity, for a given set of bits, the occurrences of bits whose value is 1 are counted. If that count is odd, the parity bit value is set to 1, making the total count of occurrences of 1s in the whole set (including the parity bit) an even number. If the count of 1s in a given set of bits is already even, the parity bit's value is 0. In the case of odd parity, the coding is reversed.
The frame odd parity bit value is required and used to ensure that data communicated between the master controller and the TUSS44x0 device has not been compromised or corrupted when transmitted or received. The odd parity bit value is generated by both the master and slave devices, and is included as bit 8 of the 16 bit frame. The odd-parity bit is always assumed to be a value of 0h prior to performing the odd parity bit calculation on the entire frame.
The master-to-slave (MCU to TUSS4470 over the SDI line) frame from MSbit to LSbit is: 1 RW bit, 6 bits for the register address, 1 ODD parity bit for entire SPI frame, 8 bits for data.
Odd Parity Bit Calculation Examples:
In this case, there are only two bits set to '1' due to the read high bit and the register address, so the parity bit is set to '1' to create an odd number of '1' bits in the entire 16-bit frame.