cancel
Showing results for 
Search instead for 
Did you mean: 

External ADC Sampling with DMA (Timing & Configuration)

ZIMMI99
Visitor

 

Hi everyone,

I’m working on a project using an STM32 microcontroller (STM32H745IITx), and I’m trying to set up a DMA transfer for an external 12-bit, 20 MSPS ADC with a 12-bit parallel interface. On my custom board, the data pins of the ADC are routed to the GPIOF port. The ADC clock is generated using Timer 3's PWM output (running at approximately 18 MHz). Additionally, I have an external interrupt (Trigger) that I use to start a measurement.

I want to achieve the following:

  1. The external interrupt should start the DMA transfer.
  2. The DMA should then transfer the GPIOF port data on every Timer 3 interrupt event.

I’ve done some research and found that the DMA must be set to Memory-to-Memory mode to achieve this. However, it’s not clear to me:

  • When I call HAL_DMA_Start_IT, does the DMA transfer the entire buffer at the specified DMA speed?
  • Or, is there a way to link the DMA transfer to Timer 3, so that the DMA reads the GPIO port on every Timer 3 interrupt?

Any help or clarification would be greatly appreciated


 

 

 

1 REPLY 1
TDK
Guru

Since you want the transfer to happen in response to a trigger, the DMA should be in peripheral-to-memory mode. Then, if the correct trigger happens (presumably TIM3_TRGO or similar), it will transfer.

In memory-to-memory mode there are no triggers--the entire buffer will transfer as fast as possible once it is started.

It may be difficult to set this up in STM32CubeMX but the hardware can certainly support it given the correct setup.

If you feel a post has answered your question, please click "Accept as Solution".