cancel
Showing results for 
Search instead for 
Did you mean: 

H753ZI board - Exact repeatable time required between DAC DMA and ADC DMA start

CactusPete
Associate III

We require that the time between DAC and ADC DMA start be EXACTLY the same between cycles. This next code is a simplified version of working code that works, but the delay has too much variation.  We need to eliminate any variation between cycles.

Sample time = 1 us

Buffer size for both DAC and ADC = 2000 points

Delay between DAC and ADC DMA start needs to vary between 0 to 5000 us

 

This is what occurs during ONE measurement cycle - simplified with no error checking to get the idea across.

ConversionDone = false;

CreateDacSignal(.......);

HAL_DAC_Start_DMA( &hdac1, DAC_CHANNEL_1, DacBuffer, DacSampleCount, DAC_ALIGN_12B_R );

// Time delay between DAC DMA and ADC DMA start

delay_us( delay );

HAL_ADC_Start_DMA( &hadc1, AdcBuffer, ADC_SAMPLE_COUNT );

while (!ConversionDone) delay_us(100);

 

Note: the variable ConversionDone is updated to true when the ADC conversion complete callback (end of ADC DMA conversion of 2000 points)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
CactusPete
Associate III

This is a rough timing diagram that hopefully helps explain a bit more

DAC-ADC-TIMING-DIAGRAM-Edited.jpg

The delay between measurement cycles is VERY critical and the current version is working, but software starting of DAC DMA, delay timer, and ADC DMA has far too much variation.

I've tried using the H7 DMA synch and events via HAL, but nothing works as expected.  Our app uses HAL to configure a number of other peripherals and everything works perfectly except this delay issue, so any solution should be able to work with HAL configuring peripherals.  

Thanks,

Peter

View solution in original post

1 REPLY 1
CactusPete
Associate III

This is a rough timing diagram that hopefully helps explain a bit more

DAC-ADC-TIMING-DIAGRAM-Edited.jpg

The delay between measurement cycles is VERY critical and the current version is working, but software starting of DAC DMA, delay timer, and ADC DMA has far too much variation.

I've tried using the H7 DMA synch and events via HAL, but nothing works as expected.  Our app uses HAL to configure a number of other peripherals and everything works perfectly except this delay issue, so any solution should be able to work with HAL configuring peripherals.  

Thanks,

Peter