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.

[参考译文] BQ27Z561:检测 bq27z561的从器件地址是否未出现在打开的 i2c 总线上的方法是什么?

Guru**** 2538950 points
Other Parts Discussed in Thread: BQ27Z561

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

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/973512/bq27z561-what-is-way-to-detect-slave-address-of-bq27z561-is-not-present-on-open-i2c-bus-or-not

器件型号:BQ27Z561

我已读出 "ioctl(file, I2C_SLAVE, addr);不会尝试检测具有给定地址的器件是否存在"。

实际上,我在“/dev/i2c-2”上连接了2个从设备。   一个是 BQ27Z561、另一个是 ADC。

我需要集成代码、以便如果此总线上不存在 BQ27Z561的从地址("/dev/i2c-2 ")、则必须使用 ADC 来显示电池百分比。

但我 需要的代码告诉我"此总线上不存在 BQ27Z561的保存地址("/dev/i2c-2 ")"

因此、请提供检测"/dev/i2c-2 "上是否存在具有指定地址的器件的方法。

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

    Mangal Prajapati、您好!

    如果总线上没有器件、则只会发送一个 NACK。  您只需添加一个检查、以便在返回 NACK 时使用 ADC。