2025-06-18 3:26 AM
Hello everyone,
I'm currently working on a project using an ADS8688 ADC IC and an STM32F446RET6 microcontroller.
I'm encountering an issue where I'm consistently reading random or garbage values over SPI, even when I'm applying stable input voltages to all 8 channels of the ADS8688. I've verified the input voltages with a multimeter, and they are as expected.
Here's a brief overview of my setup and what I've tried so far:
Hardware:
Problem Description: When I apply known DC voltages to the input channels of the ADS8688, the data I receive over SPI from the STM32F446RET6 is not the expected digital conversion result. Instead, it appears to be random or corrupted, showing no correlation with the input voltage.
What I've Checked/Tried So Far:
SPI Configuration (STM32F446RET6):
ADS8688 Configuration:
Wiring & Connections:
Code Logic:
Specific Questions/Areas for Advice:
Hello everyone,
I'm currently working on a project using an ADS8688 ADC IC and an STM32F446RET6 microcontroller.
I'm encountering an issue where I'm consistently reading random or garbage values over SPI, even when I'm applying stable input voltages to all 8 channels of the ADS8688. I've verified the input voltages with a multimeter, and they are as expected.
Here's a brief overview of my setup and what I've tried so far:
Hardware:
Problem Description: When I apply known DC voltages to the input channels of the ADS8688, the data I receive over SPI from the STM32F446RET6 is not the expected digital conversion result. Instead, it appears to be random or corrupted, showing no correlation with the input voltage.
What I've Checked/Tried So Far:
SPI Configuration (STM32F446RET6):
ADS8688 Configuration:
Wiring & Connections:
Code Logic:
Specific Questions/Areas for Advice:
2025-06-18 4:06 AM
hspi3.Init.CLKPolarity = SPI_POLARITY_LOW; hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
I don't use Cube, but this to me does not sound like
> I'm using SPI Mode 1 (CPOL=0, CPHA=1)
Also, how exactly are the lines connected, which ADC pin to which STM32 pin?
How is that accomplished physically? A dedicated PCB, or some devboards connected by flying wires?
Also, how are the SPI pins set in GPIO? Very often, setting highest OSPEEDR setting with SPI (especially SCK) is wrong, as that may lead to ringings and thus unintended multiple clocks.
Ground arrangement is of paramount importance, in case of flying wires each and every SPI line has to have its own ground/return, the most important is to keep SCK separated.
I personally would start with no attempt to program the ADC (i.e. transmit only zeros into ADC - see in the ADC's DS what's the consequence of that, I did not investigate that deeper if that's the "do nothing"), and transfer data from a single channel, perhaps even clocking "manually", bit-banging the chipselect and clock (maybe even literally manually, manipulating GPIO registers in debugger), while observing the individual lines (if you go really slow, even LEDs would suffice - normally a logic analyzer would be used, or a multichannel oscilloscope). If you have a logic analyzer/oscilloscope, then just compare the observed waveforms with what's in the ADC's datasheet. The first thing to look for would be the first 16 bits outputting from the ADC being all zeros.
JW
PS. Out of curiosity, what tool did you use to prepare that initial post?
2025-06-18 5:25 AM
Here's how the data sheet says to read a sample:
You can see it sends 16 bits and reads another 16 bits. You don't do this in your code.
Your ADS_Read_All_Raw function sends and receives 16 bits at a time, not 32, so it never even receives data.
2025-06-18 7:09 AM
> Your ADS_Read_All_Raw function sends and receives 16 bits at a time, not 32, so it never even receives data.
Well, but then it should be receiving all zeros, shouldn't it.
JW
2025-06-18 7:17 AM - edited 2025-06-18 7:24 AM
PS:
@Shivabalan wrote:
- Are there specific register configurations on the ADS8688 that are critical for initial sanity checks or basic functionality?
That would be a question for TI:
https://www.ti.com/product/ADS8688#support-training
TI have a Linux driver for this part: https://www.ti.com/product/ADS8688#software-development - have you tried looking at that?
2025-06-18 7:44 AM
Yes.
Looking again, the code does actually send and receive 2 16-bit values as the word size is 16-bit. But since the arrays are sized as 1x uint16_t, there is an out of bounds write happening. It could be clobbering the loop variable.
2025-06-18 9:04 AM - edited 2025-06-18 9:07 AM
Okay, so there are known problems at multiple levels.
This is why I'd recommend to go step by step, starting with some slow, possibly bit-banged, single-channel acquisition, observing the output using LA/oscilloscope, to get acquainted with the basics.
JW