cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any collision when CPU and DMA access the same address?

tecnico23
Associate II
Posted on November 20, 2012 at 10:35

Hi,

I would like to know if there is any collision when the CPU needs to access to a address that is used by the DMA controller.

For example, when an event occurs the DMA should transfer 5KB from memory to USART, that is linked to a host PC via RS232. What can happen, if the CPU of the controller needs to update one or more parameters in data addressed between the 5KB? If the address to be accessed is not be used by the DMA, maybe nothing wrong will happen. But what if both access to the same memory? Will a collision occur? Is there any arbiter? Should I implement code to prevent it?

Thank you all in advance for interesting in this topic.

Best regards,

A. Paiva
1 REPLY 1
frankmeyer9
Associate II
Posted on November 20, 2012 at 12:57

I would like to know if there is any collision when the CPU needs to access to a address that is used by the DMA controller.

 

Not physically. This accesses are arbitrated and serialized.

But a semantical collision would surely occur. If you peek into a buffer the DMA is about to update, the result will be arbitrary and random. This would qualify for a nasty race condition bug.