Hi,
I am using MPC5777C in our project, and we are communicating with another controller over SPI.
We want to enable parity check, problem here is in MPC5777C the parity bit will be added at the last bit, whereas the other side it appends the parity bit at the end of the data frame.
Eg: If my data size is 16bits
MPC5777C adds parity bit at 15th bit position, Otherside it adds parity bit at 16th bit position.
In order to transmit data with parity i want to reduce the data length to 8bit data.
My question here is if i change my data length to 8bits parity will be added at 7th bit or still 15th bit.
If there are any suggestions that will be great.
Hi,
please read chapters 4.5.10 and 4.5.10.1 of the device RM to know how the parity can be generated.
It is controlled by respective bits in CMD word, so you can generate teh parity at the end of frame using continuous format. Parity is always replacing the last bit if it is enabled.
So if you want to send 16bits + parity in one frame then you should use continuous selection format with 2 different CTAR data sizes (8 and 9).
The config could be following...
CTAR0.B.FMSZ |= 7; // 8bit frame
CTAR1.B.FMSZ |= 8; // 9bit frame
PUSHR.R = 0x8001 | high_8bit_data; // CONT=1, CTAS=0, PE=0, PP=0, PCS=1
PUSHR.R = 0x1201 | low_8bit_data<<1; // CONT=0, CTAS=1, PE=1, PP=0, PCS=1
BR, Petr