How to read the current DMA buffer pointer correctly?
Hello,
I'm using an stm32f429zit6's ADC in triple interleaved DMA mode. They're giving me 7.2 Msps currently.
The ADC is continuously running in circular mode and filling a buffer with a size of 3000.
So I wanted to find out the DMA buffer pointer when a trigger happens to later order the data before and after the trigger event properly.
I realize that the NDTR register in the DMA2Stream0 stores the required data for me, So to verify that I used the following lines in the ADC conversion complete callback function,
and expected to see 0 (or 2999 which is the buffer maximum length) for the Buffer_Addr_At_Trigger variable in the debug mode.
But it didn't give me a consistent value for the variable and instead I get some random value between 0 to 2999 from the register each time the debugger gets to the breakpoint.
What can be the issue?
void HAL_ADC_ConvCpltCallback (ADC_HandleTypeDef* hadc1) {
Buffer_Addr_At_Trigger = hdma_adc1.Instance->NDTR;
}