cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to stop ADC-DMA transfers when debugging?

Fibo
Associate II

I have an ADC1 setup in continuous mode and DMA1 in circular mode setup to transfer adc data to a circular buffer in memory. The data is processed directly from the circular buffer and the buffer is big enough that the processing is done before the buffer overflows.

This setup has been challenging to debug since the ADC is not stopped during debugging so it is impossible to look at the data that is being processed. Is there a way to halt the ADC/DMA when stepping through code using the debugger?

I'm using HAL libraries in IAR's EWARM and an st-link/v2. The mcu is a STM32L496.

Enabling the option "disable interrupts when stepping" in EWARM does not help either.

2 REPLIES 2

> ADC1 setup in continuous mode

> Is there a way to halt the ADC/DMA when stepping through code using the debugger?

In this setup, AFAIK, no.

A possible workaround is to trigger ADC from timer, which in turn can be suspended while debugging, see freeze registers in DBGMCU.

JW

Fibo
Associate II

Solved this issue by putting ADC in discontinuous mode and triggering the ADC conversions using a timer. Setting the freeze bit of the timer means ADC will also stop when mcu is halted by the debugger. Works like a charm!