Best way to suspend a triple interleaved ADC working in DMA mode 2 And to know the buffer address being written at suspension
Hi,
I've configured the triple ADCs in Interleaved mode with DMA writing the ADC data in circular mode 2 on my Stm32f429 Discovery board.
What I'm trying to implement is:
- Initialize DMA and ADCs
- Wait for an external interrupt
- Pause the DMA transfer
- Show the captured waveform on LCD
- Resume the DMA transfer, goto step 2
So I wanted to know what is the best way to suspend the ADCs when the external interrupt happens with the HAL functions.
I'm already using this piece of code but I wanted to see if there's a more efficient way:
HAL_ADCEx_MultiModeStop_DMA(&hadc1);
HAL_ADC_Stop(&hadc2);
HAL_ADC_Stop(&hadc3);Also, I need to know which address in the buffer was being written at the time the interrupt happened.
The AN4031 notes that:
The DMA_SxNDTR register contains the number of remaining data items at the moment when the stream was stopped so that the software can determine how many data items have been transferred before the stream was interrupted.
So I suppose that by using the code below I can find which address of the buffer was being written at the time suspension occurred?
Buffer_Addr_At_Trigger = (Total_Buffer_Length) - (DMA2_Stream0->NDTR);Thanks in advance.
