Answer the question
In order to leave comments, you need to log in
How to properly set up DMA interrupts on STM32F4?
New tasks for STM32F4, and I have, accordingly, new questions. This time - to the HAL library and the logic of the DMA interrupts. I'm trying to organize a DMA ring buffer into which the ADC dumps information on interrupts from the timer. There are no problems with this part, it works perfectly.
But now I'm trying to raise the flags for processing the information buffer from the ADC using DMA interrupts. The first rises when half of the buffer is filled, the second - when the entire buffer is filled. It would seem that the code is elementary:
/* Функция обработки прерывания от DMA2 */
void DMA2_Stream0_IRQHandler(void) {
HAL_DMA_StateTypeDef DMA_State;
// Заполняем структуру состояния DMA и сбрасываем флаги
HAL_DMA_IRQHandler(&hDma_MicAdc);
// Как только заполнена первая половина буфера, поднимаем флаг обработки
DMA_State = HAL_DMA_GetState(&hDma_MicAdc);
if (DMA_State == HAL_DMA_STATE_READY_HALF_MEM0) {
MicData_handle_flag = FIRST_HALF;
} else if (DMA_State == HAL_DMA_STATE_READY_MEM0) {
MicData_handle_flag = SECOND_HALF;
}else {
MicData_handle_flag = NONE;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question