Reading 1 MSPS ADC with the STM32G431

Thread Starter

8dm7bz

Joined Jul 21, 2020
199
Hello,
so I bought this ADC (ADS7054) and got a STM32G431. Now I thought I can read the 1 MSPS ADC output with this microcontroller. I tried setting everything up with the conveniant help of the STM32CubeIDE. Since the ADC datasheet states that it is SPI compatible, I gave it a shot. But I can't figure out how to configure the microcontroller to give appropriate SPI signals (CLK, MISO, CS). The ADC only transmits data, so no MOSI line is needed.

I don't change the registers too much. Everything is is at reset except the following:

PA4: SPI1_NSS (Chip select)
PA5: SPI1_SCK (Clock)
PA6: SPI1_MISO (Data line)

The mode is set to be "Receive only Master", and the datasize is set to be 9 bit (since the ADC needs 18 clocks for the conversion, I planned on giving it 2 times 9 clock cycles). The Baud Rate is set to 8MHz (HSI clock divided by 2 (Baud prescaler)).

The problem I get is when I try to receive only 9 bits (9 clock cycles) I can see on my scope, that the STM32G431 generates sometimes 18 clock cycles or even more (always a multiple of 9 though)

I wonder about the feasability of the STM to control the ADC. What are your thoughts, any ideas what I could try ?

Also, a related but different question: I got myself this ADC and it needs a custom protocol. Is it reasonable to generate an SPI clock of 40MHz (to get the 1MSPS from the ADC) ? Or should I go with a FPGA in this case ? (or even something else, a dedicated IC ?)

Yet another question: is there a microcontroller with an integrated 16 or 14 bit 1MSPS ADC ?

-8
 

BobTPH

Joined Jun 5, 2013
8,804
From the datasheet:
In the CNV state, the device uses the external clock to convert the sampled analog input signal to an equivalent digital code as per the transfer function illustrated in Figure 35. The conversion process requires a minimum of 18 SCLK falling edges to be provided within the frame.
Bob
 

Thread Starter

8dm7bz

Joined Jul 21, 2020
199
Well I need 3 ADC's, but I will probably be better of with 2 microcontrollers. I will try to get the oversampling working and come back with the results.

thanks
 

bogosort

Joined Sep 24, 2011
696
And can I sample >1MSPS with 16bit oversampling enabled ?
Not even close. To get n more bits of precision by oversampling and decimating, one needs 4^n excess samples. With a 12-bit ADC, you'd need 4^4 = 256 12-bit samples to create a single 16-bit sample. Thus, your effective sample rate is 1E6/256 = 3.9 kHz.
 

Thread Starter

8dm7bz

Joined Jul 21, 2020
199
Alright thanks for explaining. Am I right to assume, this micro (STM32H750) has 3 parallel ADC's with 16 bit each at up to 3.6 MSPS ?

-8
 
Last edited:

Thread Starter

8dm7bz

Joined Jul 21, 2020
199
It's a 0-4Vpp 20-100kHz signal, that has artifacts not dependant on frequency or voltage. The signal gets clipped at >2V and is also wider, at this clipping point. I want to measure this artifact. I don't have a practical thing in mind, it's just for my amusement :D
 

MrChips

Joined Oct 2, 2009
30,704
Now I have three questions:
1) Why 3 channels?
2) Why 16-bit resolution instead of 12 bits?
3) Why 1MSPS instead of 200kSPS?
 

Thread Starter

8dm7bz

Joined Jul 21, 2020
199
Well those 3 ads's thing isn't a hard constraint. I just had something in mind to try with 3. I probably could do it with one adc and use the channel thing to switch between the pins. And 16 bits at min. 1MSPS because that is what I found to be reasonable priced. I just want to experiment a bit with an ADC with a setup below 10 bucks. And I think such an ADC is to be found below this price. The STM32H750 is priced at around 6 dollars. Which I find crazy cheap for the ADC it has, if my assumption is right that it can do it. Can it ?
 

MrChips

Joined Oct 2, 2009
30,704
You still have not answered the three questions. Why build a rocket to get you to Mars when you are only going to the moon? Be realistic.

The chip alone might cost $6 but it will cost much more than that in order to start playing with it.
I would recommend spending the money on a low cost development board such as STM32F072B-DISCO and try out an ADC with 12 bits @ 200kSPS first before aiming for the sky.

Hardware is only on part of the puzzle. You still have to learn how to program the hardware.
 
Top