cancel
Showing results for 
Search instead for 
Did you mean: 

DMA does not write from ADC to memory

BBoro
Associate

I use STM32H743 and STM32CubeMX.

ADC1 operates in ADC_CONVERSIONDATA_DMA_ONESHOT mode.

Writes 512 samples to memory (address 0x24003F20).

After recording, I process the data and run DMA again.

But the data in the memory area does not change (as if frozen).

If you simply restart the DMA in a loop (without reading them in the program), then the data is written and changed.

Why? And what needs to be done so that the data changes and there is access to them?

Souce code

in main:

HAL_ADC_Start_DMA(&hadc1, (uint32_t *)&arcanbuff0[2], 512); // start ADC DMA

HAL_TIM_Base_Start(&htim8); // Start trigger for ADC samplerate 2MSPS

while(1){

if(IsIntADCDMA == 1) { // wait DMA

IsIntADCDMA = 0;

HAL_ADC_Start_DMA(&hadc1, (uint32_t *)&arcanbuff0[0], 512); // restart DMA

}

};

Handle DMA (only copy data):

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)

{

if(hadc->Instance == ADC1)  {

if(IsIntADCDMA == 0) {

IsIntADCDMA = 1;

uint32_t *Src = (uint32_t *)&arcanbuff0[0];

uint32_t *Dst = (uint32_t *)&Engine_UintAADC0[0];

uint32_t *End = (uint32_t *)&Engine_UintAADC0[256];

while(Dst < End) { // only copy data, If this cycle is commented, then everything

// works and data in arcanbuff0 renew, otherwise not renew

*Dst++ = *Src++;

}

}

}

}

Thanks in advance.

1 REPLY 1
BBoro
Associate

Thanks, but I have figured it out myself.

It was necessary to disable caching using HAL_MPU_ConfigRegion.