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.

DRV8316: About Parity bit, P

Guru 21045 points
Part Number: DRV8316

Hi Team,

 

I understand that Parity bit is “Error detection code bit”.

-SPI_PARITY resister is 0x0, No SPI parity error is detected

-SPI_PARITY resister is 0x1, SPI parity error is detected

 

Could you please let us know the behavior or Parity bit at the following condition?

-If SPI_PARITY resister is 0x0, Parity bit is “0” or “1” or “Indefinite”.

-If SPI_PARITY resister is 0x1 and data bit "1" is even, Parity bit is “0” or “1”.

-If SPI_PARITY resister is 0x1 and data bit "1" is odd, Parity bit is “0” or “1”.

 

Regards,

Hide

  • Hello Hide,

     

    Thank you for your question! The way the parity bit works is that the parity bit is either a "0" or a "1" depending on which one is necessary to make the 16 bit register have an even number of 1s. Once the driver has received the 16 bit SPI command it checks to see if there is an even number of 1s. If there is not an even number of 1s than that means that the data that was supposed to be transmitted was different than the data that was received. If this is the case then the SPI_PARITY register will read 0x1 to indicate that the data was corrupted.  if you wanted to write the bits 11001010 to register 001011, then the 16 bit SPI command would be formatted like this:

    0001011p11001010

    where p is the parity bit. since there is an odd number of 1s in this example (7), the parity bit p is set to 1 so that there would be an even number of 1s in the SPI command. The command that you would send would be 0001011111001010. The DRV would receive this command and count the number of 1s in the command to make sure that there is an even number of 1s. If one of the bits was corrupted during transmission, that would result in there no longer being an even number of 1s and that would trigger a SPI_PARITY fault.

     

    Parity detection is only effective when the number of bits that are corrupted is an odd number of bits. If an even number of bits get corrupted during transmission then there will still be an even number of 1s that are detected, and the parity check would not detect that data has been corrupted.

     

    I hope that helps,

     

    Anthony

  • Hi Anthony-san,

     

    Thank you for your prompt reply and information.

    I greatly appreciate your cooperation.

     

    Regards,

    Hide

  • Thanks Hide-san!