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.

TPS92682-Q1: TPS92682 Parity calculation

Part Number: TPS92682-Q1

Hello ,

Could you please give a correct method to calculate the parity for the SPI command to communicate with TSP92682. We are getting invalid responce while using the method define in the datasheet. The SPE bit is always high. 

  • The correct way to implement the parity calculation described in the datasheet for http://www.ti.com/product/TPS92682-Q1/technicaldocuments is as follows. The uint16 assembledCmd variable below is the 682 command frame that you would like to use for the parity calculation. 

    UInt16 parity = 0;
    UInt16 packet = 0; // This will be what we return 
    uint16 packet = assembledCmd;

    while (assembledCmd > 0) // Calculate parity
    {
        if ((assembledCmd & 0x0001) == 1) // Count the number of 1s in the LSb
            parity++;

        assembledCmd >>= 1; // Shift right
    }

    if ((parity & 0x0001) != 1) // If the LSb is a 0 (even # of 1s), we need to add the odd parity bit (add / set parity bit for an odd number of bits total, if we already have an odd number do not set parity bit)
        packet |= (1 << 8);

    return (packet);