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.

[参考译文] AFE4404:在 python 中通过 I2C 写入寄存器

Guru**** 2513185 points
Other Parts Discussed in Thread: AFE4404

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

https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/866224/afe4404-writing-registers-through-i2c-in-python

器件型号:AFE4404

使用 python 配置器件时遇到问题。 我能够确认在 Arduino 上的 C 语言操作是否成功、因此硬件工作正常。

出于某种原因、我只能写入读取/写入寄存器(0x00)。 写入后、每个其他寄存器返回0x00的值。 我正在使用 AdafruIT_GPIO_I2C 库、我也尝试了 smbus 库、但收到了相同的结果。

sensor.device.write8(0x00、0)#使 能写入

sensor.device.write8(0x0a、255)#writes value of 255 to 0x0a

sensor.device.write8(0x00、1)#使 能读取

sensor.device.readList(0x00、1)#read 1 byte from 0x00

sensor.device.write8(0x0a、1)#read 1 byte from 0x0a

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

    尊敬的 Marc:

    在 AFE4404中、所有寄存器为24位宽、因此对于寄存器写入、您需要向给定寄存器写入3个字节(24位)。 此外、在读取时、您必须从寄存器中读取3个字节。 从您的波形中、我看到您只向寄存器写入/读取1个字节。

    寄存器0x00是只写寄存器、您可以在不读取0x00寄存器的情况下尝试写入。

    此致、

    Prabin。