PSoC6: Getting current DMA destination pointer

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

cross mob
JaSi_1632926
Level 4
Level 4
Welcome! 25 replies posted 10 replies posted

Hi,

I want to know how to retrieve the current DMA descriptor pointer. I have a SCB UART with DMA on the RX port, which writes into a memory buffer. I can see that the data is retrieved and stored in the buffer, but I don't understand how to get the current memory address.

The cy_stc_dma_descriptor_t struct's dst value doesn't seem to change. Is there any other way to get it?

Thanks, Jacob

0 Likes
1 Solution

I used DMA_HW->CH_STRUCT[DMA_DW_CHANNEL].CH_IDX which is updated exactly as I expect it to be.

View solution in original post

0 Likes
7 Replies
Yeshwanth_KT
Employee
Employee
50 replies posted 25 replies posted 10 likes received

Hi Jacob,

You can use the functions mentioned below to get the current source and destination addresses.

community2.png

If you have any more doubts please feel free to ask.

Regards,

Yeshwanth

0 Likes

Hi,

That gives me an incorrect address - which I guess is because it's using the hardware DMA block as pointer - which is shared between several DMA channels.

The destination address per channel needs to be stored somewhere, but where?

Thanks, Jacob

0 Likes

.. and even if I disable all other DMA channels using the same hardware DMA, Cy_DMA_GetActiveDstAddress seems to give me only the pointer I specified when calling Cy_DMA_Descriptor_SetDstAddress, not the actual address currently used (which is an address within the buffer given). I can see that data is added to the buffer, but the adress is never incremented.

0 Likes

It seems like the DWn_CH_STRUCTm_CH_IDX register can be used together with the base buffer address to figure out where in the buffer the DMA currently is.

Is this the recommended way?

0 Likes

Yes, I checked that "Cy_DMA_GetActiveDstAddress()" is getting the destination address set for the current descriptor and not the address of the current transfer. For every Data wire controller there is a structure created as below,

community3.png

"Cy_DMA_GetActiveDstAddress()" was returning the "ACT_DESCR_DST" from the structure. The one you need is "ACT_DST". Which can be accessed by "DMA_HW->ACT_DST". Please use this to access the active destination.

I used DMA_HW->CH_STRUCT[DMA_DW_CHANNEL].CH_IDX which is updated exactly as I expect it to be.

0 Likes

Yes, "DMA_HW->CH_STRUCT[DMA_DW_CHANNEL].CH_IDX" will give you the index of the current transfer. You can calculate address by using the initial destination address and the index obtained.

The easy way is to use "DMA_HW->ACT_DST" which directly gives the calculated address. Use whichever that suits your application well.

Regards,

Yeshwanth