cancel
Showing results for 
Search instead for 
Did you mean: 

ADC conversion speed - I'd like to be able to achieve an ADC 16 bit conversion at up to 1MHz

Alexmouse
Senior

I'm measuring on ADC1_IN0, triggered by a timer. I'm using an output pin to indicate the timing of the conversion start and completion. The ADC clock is 60MHz, clock prescaler async / 4. A 16 bit conversion appears to be taking about 6uS. What do I need to do to speed this up? STM32H745, Disco board.

9 REPLIES 9
S.Ma
Principal

There are 2 types of typical adc, binary search which uses resistor dividers, and 12 bit is near state of the art at cost, extra bit is oversampling, typically 2 samples for 13 bit, 4 samples for 14 bit, 16 samples fod 15 bit, etc... digital filter is a non brute force way to explore.

The other one is sigma delta 1 bit adc, which requires more time to get 16 bits. Some STM32 have them,.maybe STM32F3xxx

Alexmouse
Senior

The STM32H745 data sheet suggests it should be capable of 3.6Msamples.​

AScha.3
Chief II

the adc can run at 3,6 Msps . depend, how you set it.

  • use clock around 30M . so divider 2...
  • set in Cube: sampling time 2.5
  • conv. now < 1us , report it.
If you feel a post has answered your question, please click "Accept as Solution".
Alexmouse
Senior

How do you configure sampling rate in CubeMX?

I can see via the debugger that the default sampling setting is SMPx(2:0) = 000.

I've set the ADC clock source at 30MHz.

With sampling set at 1.5 or 2.5 clocks, a conversion appears to be taking about 4uS, judging by an IO pin set at trigger and cleared when the data is taken.

Sampling for 64.5 clocks, it takes about 22uS, 810.5 clocks, 240uS.

Clearly I am missing something.

I've another timer toggling an led at 1Hz, just to be sure by clock tree is working as I expect.

AScha.3
Chief II

Oo - simple calculation : 240us / 810 = 0,3us ; so clk about 3 MHz ! (not 30 ! )

so you are about 10x too slow (from clock) and get 4us , but 0.4us would be possible.

>How do you configure sampling rate in CubeMX?

  1. see clock configuration -> clk to ADC (i took about 100 MHz)
  2. in ADC parameter settings -> clock prescaler + (for selected rank + channel) sampling time

If you feel a post has answered your question, please click "Accept as Solution".
Alexmouse
Senior

It is the STM32H745 Discovery board, 25MHz crystal, clock configurator reports 30MHz ADC clock.

I've Timer17 toggling an led at 1Hz, 75MHz clock, prescale 749, count of 50,000, this works as expected.

I'm not seeing sampling times in CubeMX, only clocking options in binary steps?

AScha.3
Chief II

(i am on H743 , single core ; maybe you have to select core M4 or/and M7 )

but nothing should be red color !! this will not work the "right" way.

+

in clock tree

0693W00000Y7rKdQAJ.png+

0693W00000Y7rMjQAJ.png+

0693W00000Y7rN3QAJ.png 

try.

If you feel a post has answered your question, please click "Accept as Solution".
Alexmouse
Senior

Ah thanks, now I see the sampling settings!

I'm only looking at the M7 core at the moment, 30MHz ADC clock configured. As you say, there is a factor of 10 error, but I'm baffled as to what it is.

Alexmouse
Senior

An update - I've raised a support ticket, and received an example project running the ADC at 1MHz and DMAing into memory. This works fine. Now to figure out why my code didn't...