STM32F7: SPI and DMA FIFO advices
Hello!
I’m pretty new at STM32 and I have small hobby project with STM32F7 series.
I used LL library.
I communicate with external sensors through SPI. STM32 – master, external sensors – slaves. External sensors “data ready�? pins allow me to initiate data transfer requests. Data packets pretty small and frequent: 7 bytes, 11 bytes (different sensors) and ~4kHz frequency.
I used DMA for sending\receiving this data. It configured like this:
LL_DMA_InitTypeDef init = {};
…
init.PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE;
init.MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE;
init.Mode = LL_DMA_MODE_NORMAL;
init.FIFOMode = LL_DMA_FIFOMODE_ENABLE;
init.FIFOThreshold = LL_DMA_FIFOTHRESHOLD_FULL;
init.MemBurst = LL_DMA_MBURST_SINGLE;
init.PeriphBurst = LL_DMA_PBURST_SINGLE;
…I restarted DMA send\receive transfer after every “data ready�? external sensors signal with fixed data length (7 and 11 bytes).
I have some questions:
- Is it a good\bad idea to set DMA FIFO to enabled in this case (fixed send\receive transfer length)? Or should I just disable it?
- If I will set receive DMA stream (with enabled FIFO) to circular mode: does it mean that I will receive actual data only after whole FIFO filing (or part 4/8/12/16 bytes but not 7 or 11)?
- Should I change MemoryOrM2MDstDataSize\MemBurst\PeriphBurst settings in my case? I can increase transfer size if it’s necessary.
Note: I use onboard cache (enabled ICache and DCache and prepared memory regions for DMA buffers with right attributes by tuning MPU). Not sure does it affects answers on my questions.
