cancel
Showing results for 
Search instead for 
Did you mean: 

FMAC DMA preload returns 0 but X1FULL is never set and YFULL behaves strangely

KHarb.1
Senior II

I set the X1 buffer size to 18 and preloaded it with 18 values. HAL_FMAC_FilterPreload_DMA returned 0 indicating success.

Some cycles after that, I should see X1FULL go high when the DMA transfers complete. I'm not seeing this. Instead, X1FULL stays low and I see YFULL be '1' every fourth time I read FMAC->SR with Stlink+CubeProgrammer.

If I preload the entire X1 buffer via DMA, should I see the X1FULL flag go high?

How could reading the SR register generate the 000100010001000 pattern when I repeatedly read it?

 

4 REPLIES 4
evgenmlnk
Associate II

I'm having same issue with X1FULL but also OVFL and UNFL seem not to be working as expected.

The FMAC didn't work at all how I thought it did. I'm still not 100% on behavior, but it does what I need right now. give the below a shot. I can post code if needed.

Note: Using the preload command doesn't set X1FULL. You have to preload N-1 values and then write the last value to WDATA in code. 

Note: It seemed like X1FULL doesn't get set until the FMAC 'computation' command (FIR etc...) is set.  The computational command will start as soon as FMAC has data to consume.  If you are running the first FMAC command, and haven't set what the computation is yet, and then load X1, I think it does this behavior.  If X1 is preloaded full and you set the computation command, the X1Full flag will get set and life will proceed normally.

I'm also trying to figure out how FMAC works. My idea was to replicate an example of FIR filter operation in STM32G4 Reference Manual shown on p.496. I've configured FMAC to generate WIEN Interrupt. When X1 is running full the interrupt should be disabled. I run read-write sequence is  before while(1) loop.  After each w/r cycle i read FMAC register values in the arrays. I then output values in the while(1) loop with delay an read them via STMCubeMonitor, because I'm not able to read them in real time (STMCubeMonitor max. sample rate is 1ms). Unfortunately I'm not able to get X1_FULL with 6 Samples written into buffer (X1_BUF_SIZE = 6).  It seems FMAC is running faster than my code. I assume the calculation is done immediately if X1 has enough samples to perform convolution and Y is not full. I then started to icrease number of writes of X1. I was able to get X1_FULL howewer, according to my calculation there shold be 8 samples in the X1 buffer - mor then its configured size of 6. I provided screenshots of 1st and 2nd attempt with increased number of writes. The values are ofsetted for readability in STMCubeMonitor - I hope it's more or less unerstandable. If you're interested,here is my sourcecode: https://github.com/evgenmlnk/teamproject_stm32/tree/main/FMAC/nucleo-g474re-fmac-registers-test1

Screenshot 2024-08-05 012206.png

Screenshot 2024-08-05 012734.png

I never used any of the interrupt stuff and only used it for speeding up weighted sum computations in a one-shot mode rather than ongoing FIR computations.