Skip to main content
MMoha.3
Associate III
July 18, 2020
Question

How to read the current DMA buffer pointer correctly?

  • July 18, 2020
  • 3 replies
  • 2092 views

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;
}

This topic has been closed for replies.

3 replies

waclawek.jan
Super User
July 18, 2020

> 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?

> The ADC is continuously running in circular mode

JW

PLess.1
Visitor II
April 22, 2022

Did you manage to solve this?

MMoha.3
MMoha.3Author
Associate III
April 22, 2022

I do not quite remember the issue at this moment,

But at the time I was working on this project:

https://github.com/mmahdim/stm32f4scope

It is now working and only needs a bit of code cleanup.