Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3596

Interfacing (DSI, CSI, I2C, etc.) • SPI latency slow down ADC

$
0
0
hi everyone, I am using ads1263 chip, which is spi ADC. I also have the problem that time from CS to SCLK is too big to slow down whole transform. it is about 20us before the SCLK and about 10us after SCLK. the SCLK time is just about 10us. so, it makes the whole trans time to 40us. I use raspi3 modelB, and i am coding in c++ using spidev interface. my code is like below.
int8_t spi::transfer(uint8_t const* tx, uint8_t const* rx, uint32_t len)
{
if (fd >= 0) {
spi_ioc_transfer spi;
memset(&spi, 0, sizeof(spi));

spi.tx_buf = (unsigned long)tx;
spi.rx_buf = (unsigned long)rx;
spi.len = len;
spi.delay_usecs = 0;
spi.speed_hz = spi_speed;
spi.bits_per_word = 8;

int32_t ret = -1;
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &spi);
if (ret < 1) {
cout << "can't send spi message" << endl;
return -2;
}
else {
return 0;
}
}
else return -1;
}

Statistics: Posted by daiyicun — Fri Jan 26, 2024 7:37 am — Replies 1 — Views 41



Viewing all articles
Browse latest Browse all 3596

Trending Articles