dmacortex-mcontention

Cortex-M4 Memory contention (DMA against program)


I am using STM32F4xx controller. I have utilized DMA to buffer UARTs (circular buffers). My concern is that if there will be a memory contention when my program accesses the same memory location at the same time as DMA.

Can contention happen this way, or the controller has measures to prevent this to happen?

Thanks.


Solution

  • I found this in STM32F401 manual :

    The BusMatrix manages the access arbitration between masters (CPU, DMA). The arbitration uses a round-robin algorithm.

    It might happen that DMA (or CPU) can not do transfer (at the right time) due to arbitration. This causes underrun/overrun error (in DMA, CPU will wait).

    If the DMEIFx or the FEIFx flag is set due to an overrun or underrun condition, the faulty stream is not automatically disabled and it is up to the software to disable or not the stream by resetting the EN bit in the DMA_SxCR register. This is because there is no data loss when this kind of errors occur.