0

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.

alsaleem
  • 347
  • 3
  • 16
  • what do you mean by contention and what do you think will happen. You can have multiple transactions for the same address in flight at the same time, and no reason why a memory/peripheral cant handle that. Now sure there are some exceptions no doubt, but a well designed chip will queue up the transactions, put backpressure on the system or use credits and handle all transactions as they come – old_timer Mar 14 '17 at 05:09
  • 1
    contention as I understood, is the simultaneous access to same memory location (either two DMAs or DMA+program). This might generate some fault exception. My concern if the DMA will stop. This the effect that i want to avoid. There is a chance that program will read the same location that DMA is filling. – alsaleem Mar 14 '17 at 16:57
  • 1
    Memory contention occurs when the CPU and DMA both try to access the same block of memory over the BusMatrix - it doesn't have to be the same location. Additionally, DMA contention can occur if too many peripherals are moving too much data through the DMA. – rsaxvc Dec 21 '18 at 22:30

1 Answers1

1

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.

alsaleem
  • 347
  • 3
  • 16