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: Request Example S/W Code(TPS92518-Q1, TPS92682-Q1, TPS92682-Q1)

Part Number: TPS92682-Q1
Other Parts Discussed in Thread: TPS92518-Q1, , TPS92518

Hi Team,

The customer is requesting an example communication code for control of three products.

Can you share the example code?

TPS92518-Q1, TPS92682-Q1, TPS92682-Q1

  • There are only 2 parts listed in the question TPS92518 and TPS92682.

    For 518 please the data sheet section 8.6 at the following link.

    https://www.ti.com/lit/ds/symlink/tps92518-q1.pdf?ts=1616427736994&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FTPS92518-Q1

    For 682 use this as an example of how to build a frame.

    Uint16 assembleSPICmd_682(Uint16 write, Uint16 address, Uint8 data)
    {
        Uint16 assembledCmd = 0; // Build this to shift through parity calculation
        Uint16 parity = 0; // Parity bit calculated here
        Uint16 packet = 0; // This will be what we send
        if(write)
        {
            assembledCmd |= 0x8000; // Set CMD = 1
        }
        assembledCmd |= (((address << 9) & 0x7E00) | (Uint16)(data & 0x00FF));
        packet = assembledCmd;
        
        // Calculate parity
        while(assembledCmd > 0)
        {
            // Count the number of 1s in the LSb
            if(assembledCmd & 0x0001)
            {
                parity++;
            }
            // Shift right
            assembledCmd >>= 1;
        }
        // If the LSb is a 0 (even # of 1s), we need to add the odd parity bit
        if(!(parity & 0x0001))
        {
            packet |= (1 << 8);
        }
        return(packet);
    }