[FAQ] AM263P4: I2C OWN TArget Address

Part Number: AM263P4
Other Parts Discussed in Thread: SYSCONFIG

What is the meaning of I2C Own Target address in the syscfg file below. Is this related to the I2C controller or the I2C transmitter? What are the valid values it can take?

  • Hi

    This FAQ clarifies the different I2C addresses used in the AM261x MCU+ SDK, which is a common source of confusion for developers. There are two types of addresses you will come across when working with I2C in MCU_PLUS_SDK. 

    - Own Target Address (As highlighted in the image above)

    - Target address

    AM26x I2C can operate in two modes, Controller and Peripheral (Transmitter). The addressing depends on what mode the I2C is operating in.\

    Controller mode:

    AM26x I2C starts the I2C transaction, for e.g. AM261x talks to EEPROMs, LED Arrays etc. This is where the remote device's address is used.

    Peripheral mode:

    AM26x I2C waits for another Controller to initiate a transaction (for e.g. another MCU starts the transaction). This is when Own target address is used.

    In summary,

    YOUR AM26x's address -> Use "Own Target Address" in SysConfig
    REMOTE device's address -> Use "Target Address" field in i2cTransaction.targetAddress in application code.


    To dive deeper, 

    Own Target Address

    • What it is: The I2C address that YOUR AM26x will respond to when in peripheral mode.
    • When to use:
      When AM26x is in peripheral/target mode. When another controller needs to talk to YOUR AM26x. 

    • Where to set:
      In SysConfig as shown in the image below:
    • COMMON MISTAKE:
      • WRONG: "I want to talk to EEPROM at 0x51, so I set ownTargetAddr to 0x51"
      • RIGHT: You should set targetAddress to 0x51 in controller mode! ownTargetAddr is only for when YOUR AM26x is the peripheral.

    Target Address

    • What it is:The I2C address of the REMOTE device you want to communicate with.
    • When to use: When AM26x is in controller mode. When YOU initiate communication with an I2C device. For sensors, EEPROMs, LED drivers, temperature sensors, etc.
    • Where to set:
      In application code, in the I2C_Transaction structure
      I2C_Transaction i2cTransaction;
      I2C_Transaction_init(&i2cTransaction);
      
      i2cTransaction.targetAddress = 0x4C; // for e.g.Temperature sensor address
      i2cTransaction.readBuf = rxBuffer;
      i2cTransaction.readCount = 2;
      
      I2C_transfer(i2cHandle, &i2cTransaction);


      How to find target address:
      1. Check the I2C device datasheet
      2. Check your board schematic for address pin settings

    • COMMON MISTAKE:
      • WRONG: Setting ownTargetAddr to talk to a device
      • RIGHT: Set targetAddress in your I2C_Transaction in controller mode

    Regards,
    Shaunak