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

Interfacing (DSI, CSI, I2C, etc.) • issue with spi_read16_blocking with ADC

$
0
0
Hello World !

I'm interfacing a 16bit SPI ADC with RPI PICO 2. have written below code, but it throws output as "65535" always.

Need your expertise and help in know the issue with compiler or code ?

1) Using Arduino 2.0
2) tried different RX pins
3) The RX pin shows the data coming correctly

Here are the related codes for understanding.

void initialize_ADC_LTC2311() {
pinMode(CNV_PIN, OUTPUT);
digitalWrite(CNV_PIN, HIGH);
spi_init(spi1, SAMPLE_RATE);
spi_set_format(spi1, 16, SPI_CPOL_0, SPI_CPHA_0, SPI_MSB_FIRST);
gpio_set_function(SPI_MISO, GPIO_FUNC_SPI);
gpio_set_function(SPI_SCK, GPIO_FUNC_SPI);
}

void readADC() {
static uint16_t sample[4];
for (int i = 0; i < 4; i++)
{
pulseCNV();
spi_read16_blocking(spi1, NULL, &sample, 1);
Serial.println(sample, DEC);
}
}
3.jpg

1-2.jpg

1.jpg

Statistics: Posted by vinaysharma — Wed Aug 27, 2025 1:30 pm — Replies 0 — Views 28



Viewing all articles
Browse latest Browse all 7503

Trending Articles