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.

[参考译文] AM62A7:I2C 访问16位地址和16位数据从器件

Guru**** 2455560 points
Other Parts Discussed in Thread: AM62A7

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1486950/am62a7-i2c-access-to-16bit-address-and-16bit-data-slave-device

器件型号:AM62A7

工具与软件:

大家好!

我使用的是具有 Processor SDK 09.02.00版本的 AM62A7。

我想将 I2C 从器件连接到具有16位数据地址和16位数据的 I2C-1。

我曾尝试使用 SDK 中包含的 i2cget 和 i2cset、但没能了解如何使用。

root@am62axx-evm:/opt/edgeai-gst-apps# i2cdetect -y -r 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: 10 -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@am62axx-evm:/opt/edgeai-gst-apps#
root@am62axx-evm:/opt/edgeai-gst-apps#
root@am62axx-evm:/opt/edgeai-gst-apps# i2cget -y 1 0x10 0x01 0x00
Error: Invalid mode!
Usage: i2cget [-f] [-y] [-a] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE [LENGTH]]]
  I2CBUS is an integer or an I2C bus name
  ADDRESS is an integer (0x08 - 0x77, or 0x00 - 0x7f if -a is given)
  MODE is one of:
    b (read byte data, default)
    w (read word data)
    c (write byte/read byte)
    s (read SMBus block data)
    i (read I2C block data)
    Append p for SMBus PEC
  LENGTH is the I2C block data length (between 1 and 32, default 32)
root@am62axx-evm:/opt/edgeai-gst-apps#

如何将16位地址/数据从器件与 AM62一起使用?

此致、

SK

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

    亲爱的大家好

    下面是我自己问题的答案。

    我会忘记使用 i2ctransfer 而不是 i2cget/set。

    下面是一些示例 i2c-tools 新手像我一样。

    Ex1) 从16位地址读取16位数据

    I2C_BUS:0

    I2C 从机地址:0x20

    读取地址:0x1234

    -> i2ctransfer -y 0 w2@0x20 0x12 0x34 R2

    EX2)将16位数据写入16位寻址的寄存器

    I2C_BUS:0

    I2C 从机地址:0x20

    写入地址:0x1234

    写入数据:0xdead

    -> i2ctransfer -y 0  W4@0x20 0x12 0x34 0xDE 0xAD  

    如有任何问题、请更正。

    谢谢!

    此致

    SK

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

    您好、SK、

    感谢您分享您的解决方案! 这看起来很合理。 您可以通过从该存储器地址读回该地址并查看该值是否发生了更改以与之前写入的值相匹配、来验证写入是否正确。

    此致、

    Nick