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.

[参考译文] ADS8686S:无法从 ADS8686S 读取数据

Guru**** 1953960 points
Other Parts Discussed in Thread: ADS8686S, AM625
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/1377105/ads8686s-unable-to-read-data-from-the-ads8686s

器件型号:ADS8686S
主题中讨论的其他器件:AM625

工具与软件:

您好!

我正在尝试使用 AM625电路板中的 SPIdev0.0从 ADS8686S 中读取数据。我们使用的是 ADS8686S-EVM。

 我已经将 SER/BYTE/PAR 引脚连接到逻辑高电平(3.3V)、将 DB9连接到逻辑低电平(GND)以选择串行接口模式。 DB4连接到 GND 以选择1线模式。

下面是我尝试从寄存器读取数据的测试代码。

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/spi/spidev.h>
#define SPI_DEVICE "/dev/spidev0.0" // SPI device path (change according to your setup)
int main() {
int fd;
unsigned char tx_buffer[2] = { 0x20, 0x00 }; // Example TX buffer (send 4 bytes of 0x00)
unsigned char rx_buffer[2] = { 0 }; // RX buffer to store received data
struct spi_ioc_transfer transfer = {
.tx_buf = (unsigned long)tx_buffer,
.rx_buf = (unsigned long)rx_buffer,
.len = sizeof(tx_buffer),
.delay_usecs = 0,
.speed_hz = 10000000, // SPI clock speed in Hz (adjust as needed)
.bits_per_word = 8,
};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/spi/spidev.h>
#include <linux/spi/spi.h>
#define SPI_DEVICE "/dev/spidev0.0" // SPI device node
int main() {
int spi_fd;
uint16_t reg_address = 0x0400;
uint16_t tx_buffer[1] = {0x2000}; // Transmit buffer
uint16_t rx_buffer[1] = { 0x0000}; // Receive buffer
// Open SPI device
spi_fd = open(SPI_DEVICE, O_RDWR);
if (spi_fd < 0) {
perror("Error opening SPI device");
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

我已尝试过这两种方法、但 Rx_BUFFER 中的值始终为0。

请检查此问题。

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

    您好、naveenkumar、

    您能否发布一个原理图片段、其中显示了与 ADS8686S 的连接以及显示您的控制线路的范围或逻辑分析仪图?  函数帮助、但图片值一千行代码...

x 出现错误。请重试或与管理员联系。