cancel
Showing results for 
Search instead for 
Did you mean: 

Interaction between peripheral's FIFO and MDMA transfer size

HWidj.2
Associate III

I've always been a little unsure about how FIFO manages data transfer, so I ran a little experiment with a logic analyzer to understand it better, the result confused me even more.

I set up OCTOSPI to transmit 128 bytes to an external QSPI memory, with MDMA to handle the data transfer from DTCM to OCTOSPI data register.

  • OCTOSPI FIFO Threshold = 16.
  • MDMA uses Buffer Transfer mode with buffer transfer size = 16 bytes.
  • MDMA buffer transfer is triggered by OCTOSPI FIFO threshold request.
  • I enabled MDMA's Buffer Transfer Complete interrupt, for the sole purpose to toggle a pin in the ISR as an indicator that OCTOSPI FIFO has requested a buffer transfer.

Ok so with this setup I expect to see 8 buffer transfers (16 bytes each) by MDMA to move 128 bytes of data top OCTOSPI FIFO. Here's what the logic analyzer captured.

0693W00000FABzQQAX.png 

Each transition of the bottom trace (yellow) indicates an MDMA buffer transfer complete event. There are only 7! But all 128 bytes of data were successfully transmitted without error (I verified by reading them back). OCTOSPI fifo is 32 bytes deep, so maybe it pulled in 32 bytes in the first buffer transfer? But each buffer transfer should generate an interrupt, so there should still be 8 interrupt in total, no?

In the second experiment I increased the buffer transfer size to 64, OCTOSPI FIFO threshold is still 16.This time the buffer transfers occurred twice, as expected.

0693W00000FABzoQAH.png 

What I don't understand is how come MDMA was able to push 64 bytes into the 32 bytes deep FIFO? I guess there exist some sort of mechanism in the hardware that prevents FIFO being overrun by DMA transfer. With this in mind, I wonder, how should one determine the DMA buffer transfer size that yields the most efficient transfer to a comm peripherals with FIFO like OCTOSPI or SPI? And how does FIFO threshold come into the equation?

1 REPLY 1
samob2703
Associate II

Hello!

I have alot of problems connecting MDMA to OCTOSPI1. I am using stm32h723zg and external flash EN2464-104HIP. I tried all logical and unlogical configurations and still doesnt work. Could you help me out and provide me with some sample code and cube configuration?

Thanks in advance