AnsweredAssumed Answered

ADC with DMA triggered by ADC Watchdog (Signal Peak Recording)

Question asked by John Craven on Dec 15, 2016
Latest reply on Sep 16, 2017 by KIC8462852 EPIC204278916

I would like to record signal peaks from an ADC to a DMA buffer.

I have this working in continuous and software triggered modes to circular buffers.

I have a adc watchdog interrupt working to detect a "high signal".

 

I am trying to put them together to record "high" peaks in the signal to a buffer.

 

what i cant figure out is how to start the DMA on event for a ADC that is already running in continuous mode with interrupts for the high level watchdog.

 

in am use HAL libraries.

 

currently i have been starting the ADC with DMA with;

 

HAL_ADC_Start_DMA(&hadc1,(uint32_t*) &ADC_Data, 5000);

 

i know i can start ADC with interrupts for watchdog using;

 

HAL_ADC_Start_IT(&hadc1);

 

what do i need in my watchdog interrupt to start DMA transfer?

 

void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc)
{
    if (__HAL_ADC_GET_FLAG(hadc, ADC_FLAG_AWD1) != RESET)
    {
        //Start DMA here
    }
}

 

Additionally:

i don't need continuous DMA or a circular buffer.

I can have a fixed buffer size. Filling to the end and stopping is fine.

I can controlled ADC triggering rate with timer to give peak sampling rate and duration

 

Basically, i need to know what HAL_ADC_Start_DMA(&hadc1,(uint32_t*) &ADC_Data, 5000); does

in addition too what HAL_ADC_Start_IT(&hadc1); does; and put that in my watchdog interrupt handler.

 

Sorry i an really new to the STM32 world. Hope one of you gurus can help.

Outcomes