Dma memory access

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ezbe_290006
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

hi,

i want to use the DMA of psoc 5 to read from the uart to an array .

my question is :

the UART is asynchronous to my ISR, what will happen if at the exact same time the DMA writes to the array the isr will read from the same address will i receive a corrupted data?

 

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

ezbe,

Corruption as you described is basically impossible.

Setting up the DMA in essence synchronizes the data transfer to the UART. 

If you were performing CPU-only transfers from the UART FIFO to RAM, it is possible to not service the UART fast enough and receive a FIFO overrun error.

Reason #1 - FIFO

There is a 4-byte FIFO on the UART component.  As long as you are removing the newly Rx'd byte immediately after it comes in, the FIFO will not get full. You can reliably pull data out of the FIFO's front-end as the newly serialized Rx data in being loaded into the back-end.

Reason #2 - DMA

Create a DMA event to move data from the UART's FIFO to RAM based on "RX FIFO not empty".   In most cases it takes at least 10-bit frames to acquire UART data.  Therefore, setting up the DMA to transfer the latest acquired Rx Data will only take a few CPU cycles from when it was first available to the FIFO.  Whereas, the next Rx data will take 10*<bit_rate> before it is available to load into the FIFO.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
5 Replies