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 access to 16bit address and 16bit data slave device

Part Number: AM62A7

Tool/software:

Hi all,

I'm using AM62A7 with Processor SDK 09.02.00 version.

I want to attach my I2C slave device into I2C-1 which has 16bit data address and 16bit data.

I tried to use i2cget and i2cset that included in SDK but failed to find out how to do it.

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#

How can I use 16bit addr/data slave device with AM62?

Regards,

SK

  • Dear all

    Here is answer for my own question.

    I'd forget to use i2ctransfer rather than i2cget/set.

    Here are some example for i2c-tools newbies like me.

    ex1) read 16bit data from 16bit address

    I2C_BUS : 0

    I2C slave addr : 0x20

    read address : 0x1234

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

    ex2) write 16bit data into 16bit addressed register

    I2C_BUS : 0

    I2C slave addr : 0x20

    write address : 0x1234

    write data : 0xdead

    -> i2ctransfer -y 0 w4@0x20 0x12 0x34 0xde 0xad

    Please correct me if anything wrong.

    Thank you,

    Regards

    SK

  • Hello SK,

    Thanks for sharing your solution! Off the top of my head that looks reasonable. You could verify the write is occurring correctly by reading back from that memory address and seeing if the value changed to match what you wrote previously.

    Regards,

    Nick