Showing results for 
Search instead for 
Did you mean: 

Use DMA for FMAC, for input

Old Man
Associate II


I am using FMAC for STM32G4.
I can't find an example FMAC_IIR_DMAToDMA.

I tried to configure a DMA instance for Input but the example was not working.
1- Besides the DMA instance, should I use 2 more DMA instances, one for input and one for preload?
2- as described in the stm32g4xx_hal_fmac.h, hdmaPreload refers to X1, X2, and Y. Then hdmaIn, should refer to the input buffer that we want to filter?
3- As far as I understand, X1, X2, Y are set/loaded during configuration phase, which is HALO_FMAC_FilterConfig/DMA. Is that correct? if yes then, preload should refer to the input buffer.

Please find here the used DMA configuration for input:


HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 0, 0);


//DMA configuration

hdma_fmac_write_preload.Instance = DMA1_Channel3;

hdma_fmac_write_preload.Init.Request = DMA_REQUEST_FMAC_WRITE;

hdma_fmac_write_preload.Init.Direction = DMA_MEMORY_TO_PERIPH;

hdma_fmac_write_preload.Init.PeriphInc = DMA_PINC_DISABLE;

hdma_fmac_write_preload.Init.MemInc = DMA_MINC_ENABLE;

hdma_fmac_write_preload.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;

hdma_fmac_write_preload.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;

hdma_fmac_write_preload.Init.Mode = DMA_NORMAL;

hdma_fmac_write_preload.Init.Priority = DMA_PRIORITY_HIGH;

if (HAL_DMA_Init(&hdma_fmac_write_preload) != HAL_OK)






//Then use this HAL function for preload

if (HAL_FMAC_FilterPreload_DMA(&hfmac, aInputValues, INPUT_BUFFER_SIZE,

aOutputDataToPreload, COEFF_VECTOR_A_SIZE) != HAL_OK)


/* Configuration Error */



One remark in the HAL FMAC driver:
line 1826, we are configuring the DMA to preload CoeffB, but I dont see how we are preloading the coeffA.
If We look back to the Polling mode, in the same configuration function, we can see that we are preloading both coeff (A and B),
in line 1795 and 1801.

With regards.