Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AD7949 读取配置信息有误? #2281

Open
ryxxjyx opened this issue Aug 21, 2024 · 1 comment
Open

AD7949 读取配置信息有误? #2281

ryxxjyx opened this issue Aug 21, 2024 · 1 comment

Comments

@ryxxjyx
Copy link

ryxxjyx commented Aug 21, 2024

HI,在此文件中drivers/adc/ad7689/ad7689.c
image
121行这个位置是否有误?
根据芯片手册只有14bit 控制位.为什么取到了spi第二个字节的数据?
image
是否需要删除这个if判断,只保留spi第三个字节和第四个字节.

@mi-zeng
Copy link

mi-zeng commented Oct 25, 2024

7949在这个repo里的读取是用4个字节完成的,而adc返回的4字节数据并没有分割(14bit adc值+14bit 寄存器值),所以第一个字节和第二个字节的前6位是该通道的adc值,第二个字节后2位、第三个字节和第四个字节的前4位是寄存器的数据,第四个字节的后4位是无关数据,所以在121行的操作里将这三个字节的数据取出放到了一个uint32_t数cfg里,且在121和124行分别对cfg进行了右移2位,因此后4位无关数据都被从cfg中去除,且cfg的bit13-bit0为14位寄存器的数据。

而且cfg的bit19-bit14实际上是adc值的后六位,但是因为对后续的no_os_field_get不影响,所以没有处理。
Snipaste_2024-10-25_16-28-32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants