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:申请示例软件代码(TPS92518-Q1、TPS92682-Q1、TPS92682-Q1)

Guru**** 2507515 points
Other Parts Discussed in Thread: TPS92518-Q1, TPS92682-Q1, TPS92518

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/987727/tps92682-q1-request-example-s-w-code-tps92518-q1-tps92682-q1-tps92682-q1

器件型号:TPS92682-Q1
主题中讨论的其他器件:TPS92518-Q1TPS92518

大家好、

客户请求一个示例通信代码来控制三个产品。

您可以共享示例代码吗?

TPS92518-Q1、TPS92682-Q1、TPS92682-Q1

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    问题 TPS92518和 TPS92682中仅列出2个器件。

    如需518、请通过以下链接查看数据表第8.6节。

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

    对于682、请使用此示例说明如何构建帧。

    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);
    }