Multiple I2C slaves on one bus / adl_busSubscribe()


#1

There are two I2C slaves attached to the same I2C bus on a Q2686RD based design.

From within my OpenAT application, I am using adl_busSubscribe(ADL_BUS_ID_I2C, 1, …) to obtain a handle to communicate with them.

As long as I am only issuing one adl_busSubscribe() for one of the two slave addresses, I can use adl_busRead() and adl_busWrite() to communicate with the slaves.

However, if I use adl_busSubscribe() twice, one for each of the I2C slave adresses, the second one fails, and subsequent adl_busRead/Write only work for the I2C slave that I specified in the first adl_busSubscribe().

Given that I2C is a bus and many slaves on one bus are frequent, this seems strange to me. There is no hardware/electrical limitation in talking to multiple slaves, so there shouldn’t be any limitations in OpenAT / ADL either. Did anyone succeed talking to multiple slaves from and OpenAT application? Any help is appreciated.

My environment is Q2686RD with Firmware 7.46.0.201108091301 and OpenAT OS 6.36.0.201108111228.

Regards,
laf0rge


#2

Hi,

You have to unsubscribe after communication. Documentation is not that detailed about it.

sI2c_Config.ChipAddress = u8Adr >> 1;
  s32Handle = adl_busSubscribe(ADL_BUS_ID_I2C, 1, &sI2c_Config);

  s32Result = OK;
  if(u8TxLen)
  {
    s32Result = adl_busWrite(s32Handle, &sAccessCfg, u8TxLen, pu8Data);
  }
  if((s32Result >= OK) && u8RxLen)
  {
    s32Result = adl_busRead(s32Handle, &sAccessCfg, u8RxLen, pu8Data);
  }

  adl_busUnsubscribe(s32Handle);

best regards,
Gregor Bader


#3

Really :question: :exclamation: :open_mouth:

What a truly bizarre idea :exclamation: :open_mouth:

As laf0rge says, the whole point of a bus is exactly that it should support multiple devices :exclamation:


#4

:laughing: We both know ADL for a long time.