cancel
Showing results for 
Search instead for 
Did you mean: 

ADC sample rate for STM32H725

Bogdan
Senior

Hello,

I am sampling two signals using ADC1 in master, and ADC2 as a slave.

For this i am using ADC1 Input3 and ADC2 Input 5, with DMA filling the 32bit buffer, with a buffer size of 2048.

Bellow are some setings how the master/slave is configured in a simplified manner

AdcHandle_master.Init.ClockPrescaler    = ADC_CLOCK_ASYNC_DIV4;//ADC_CLOCK_ASYNC_DIV4;     // Asynchronous clock mode, input ADC clock divided by 4
  AdcHandle_master.Init.Resolution      = ADC_RESOLUTION_16B;      // 16-bit 
  AdcHandle_master.Init.ScanConvMode     = DISABLE;            // Sequencer disabled (ADC conversion on only 1 channel: channel set on rank 1)
  AdcHandle_master.Init.EOCSelection     = ADC_EOC_SINGLE_CONV;      // EOC flag picked-up to indicate conversion end
  AdcHandle_master.Init.LowPowerAutoWait   = DISABLE;            // Auto-delayed conversion feature disabled
  AdcHandle_master.Init.ContinuousConvMode  = ENABLE;            // Continuous mode to have maximum conversion speed (no delay between conversions)
  AdcHandle_master.Init.NbrOfConversion    = 1;               // Parameter discarded because sequencer is disabled
  AdcHandle_master.Init.DiscontinuousConvMode = DISABLE;            // Parameter discarded because sequencer is disabled
  AdcHandle_master.Init.NbrOfDiscConversion  = 1;               // Parameter discarded because sequencer is disabled
  AdcHandle_master.Init.ExternalTrigConv   = ADC_SOFTWARE_START;      // Software start to trigger the 1st conversion manually, without external event
  AdcHandle_master.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; // Parameter discarded because trigger of conversion by software start (no external event)
  AdcHandle_master.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR; // DMA circular mode selected
  AdcHandle_master.Init.Overrun        = ADC_OVR_DATA_OVERWRITTEN;   // DR register is overwritten with the last conversion result in case of overrun
  AdcHandle_master.Init.OversamplingMode   = DISABLE;            // No oversampling
  // Configuration of ADC (slave) init structure: ADC parameters and regular group
  AdcHandle_slave.Instance = ADCy;
  AdcHandle_slave.Init = AdcHandle_master.Init;
  AdcHandle_slave.Init.ContinuousConvMode  = DISABLE;
  AdcHandle_slave.Init.ExternalTrigConv   = ADC_SOFTWARE_START;
  sConfig.Rank     = ADC_REGULAR_RANK_1;     // Rank of sampled channel number ADCx_CHANNEL
  sConfig.SamplingTime = SAMPLING_TIME;
  sConfig.SingleDiff  = ADC_SINGLE_ENDED;      // Single-ended input channel
  sConfig.OffsetNumber = ADC_OFFSET_NONE;       // No offset subtraction
  sConfig.Offset = 0;                 // Parameter discarded because offset correction is disabled
  sConfig.Channel   = ADCx_CHANNELa;        // Sampled channel number
  sConfig.Channel = ADCy_CHANNELa;
  MultiModeInit.Mode = ADC_DUALMODE_REGSIMULT;
  MultiModeInit.DualModeData = ADC_DUALMODEDATAFORMAT_32_10_BITS; // ADC and 
 DMA configured in resolution 32 bits to match with both ADC master and slave resolution
  MultiModeInit.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_1CYCLE;
 
 
 

The clock for the ADC is comming from PLL2 at 88MHZ

Then this clock is divided by 4 via ADC_CLOCK_ASYNC_DIV4. So i would expect the adc clock to be at 22mhz

The ADC is configure to sample at 8.5 cycles ( +7.5 default ones) for a 16bit resolution.

So what would be the adc sample speed? 22mhz / ( 8.5+7.5 cycles) = 1.375Msps?

I ask this because i am not abble to capture a 1000hz sinewave signal.

The main goal here, is to obtain 2Msps with this settup

But if i use ADC_CLOCK_ASYNC_DIV2 then this yelds 2.75 Msps, and i am able to perfectly measure the sine signal.

But why is this? I am missing something? How should i estimate the sample rate for the ADC?

0 REPLIES 0