cancel
Showing results for 
Search instead for 
Did you mean: 

How to Toggle a Debug Pin When ADC Conversion Starts in DMA Mode on STM32?

BitCurious
Visitor

Hello,
I am working with an STM32 G4 series microcontroller and using the ADC in DMA mode to handle continuous conversions. My goal is to SET a GPIO (debug pin) at the start of an ADC conversion and RESET it at the end of the conversion.

Currently, I am able to RESET the GPIO pin in the HAL_ADC_ConvCpltCallback() function, which is called after the conversion completes. However, since DMA mode doesn't involve regular polling or interrupt-based conversions for the start, I am unsure where to place the GPIO SET code.

Here are the details of my setup:

  • ADC Trigger Source: TIM2
  • TIM2 Configuration: FCLK = 60 MHz, PSC = 0, ARR = 469 (Triggering ADC at ~128 kHz).
  • DMA Mode: Circular, 12-bit resolution.

Is there a recommended way to toggle or set a debug pin when the ADC conversion process starts? Would I need to modify the HAL driver, or is there a way to do this using timer-based callbacks or HAL functions?

Any guidance, examples, or best practices would be greatly appreciated.

Thank you!

0 REPLIES 0