UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor geledek
Visitor
9,807 Views
Registered: ‎04-11-2014

DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution

Hi,
I am testing the AXI DMA core with Scatter Gather mode enabled.
In C code, I write and read directly to the DMA registers instead of using the Xilinx library since its easier to understand.

Please refer to the debugging information attached.
debugging.JPG
The descriptor chain is constructed in software with 0x40 alignment.
I am testing with 4 descriptors, saved in 00000000, 00001000, 00002000, 00003000.
After the tail descriptor is written into the DMA, the MM2S status register value turns 00014019, which indictes the DMA halts with a DMA internal error and SG decoder error. Meanwhile, the currect descripter register is pointing to 00001000, the second descripter and the first descripter status register value is 80000080, indicating it's completed transfering 0x80 data length.
If the DMA is currently processing the second descriptor in 00001000, the descriptor has the similar setting in its control register, ie. transferring 0x80 data. But the error indicates that "the buffer length specified in the fetched register is set to 0".
Can anyone help to explain?

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
15,582 Views
Registered: ‎08-02-2011

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution
Yeah, your SG engine only sees addresses 0xC0000000 to 0xC0001FFF so 0x00000000 is no good. The SG engine is going to go out and fetch BDs based on the mapping for the SG interface.

Oh yeah, don't worry about virtual addresses. That's only if you're running, say, linux which uses virtual memory for apps. Just use the addresses found in the address editor.
www.xilinx.com

View solution in original post

0 Kudos
10 Replies
Xilinx Employee
Xilinx Employee
9,773 Views
Registered: ‎08-02-2011

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution

Hello,

 

From the PG:

 

"This error occurs if CURDESC_PTR and/or NXTDESC_PTR points to an invalid address."

 

What are your source/dest addresses?

 

You might find this helpful

 

www.xilinx.com
0 Kudos
Visitor geledek
Visitor
9,762 Views
Registered: ‎04-11-2014

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution
Hi bwiec,
Thanks for your reply.
The CURDESC_PTR is pointing to 00000000 in the BRAM where I initiated my descriptor chain. If my DMA_SG is connected to a BRAM controller, should I use relative addressing or absolute addressing (BRAM_BASEADDRESS + relative address) when refering to descriptors in BRAM?
0 Kudos
Xilinx Employee
Xilinx Employee
9,755 Views
Registered: ‎08-02-2011

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution
Can you post a screenshot of your block design showing how you connected the DMA and also your address editor?

You likely want to use the absolute address.
www.xilinx.com
0 Kudos
Visitor geledek
Visitor
9,747 Views
Registered: ‎04-11-2014

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution

@bwiec wrote:
Can you post a screenshot of your block design showing how you connected the DMA and also your address editor?

You likely want to use the absolute address.

 

Thank you for your reply, bwiec.

 

I attached a screenshot of the block diagram and the address editor. The DMA Data_SG interface is connected to a BRAM controller. In the C program, the descriptor chain is constucted by writing to the absolute physical address of the BRAM, for example,

Xil_Out32 ( XPAR_BRAM_0_BASEADDR + i*0x40        , descriptors[i].nextDesc );

Xil_Out32 ( XPAR_BRAM_0_BASEADDR + i*0x40 + 0x8  , descriptors[i].bufferAddress );

Where the descriptors are 0x40 aligned.

 

But I write the relative address (offset to the BRAM physical address) into the DMA Cur_Desc_Ptr register. For example, the first descriptor is at 0x00 so, Xil_Out32  ( XPAR_AXI_DMA_0_BASEADDR + 0x38, 0 ), where 0x30 is the offset of DMA Cur_Desc_Ptr register. I can't find information about this in PG021 stating weither the Cur_Desc_Ptr should be absolute or relative.

 

Meanwhile, I am trying to understand the example program you attached. In xaxidma_bdring.c, it state something about the virtual address. I am confused by the presence of the virtual address here, is it related to my problem?

 

/* Must make sure the ring doesn't span address 0x00000000. If it does,
* then the next/prev BD traversal macros will fail.
*/
if (VirtAddr > (VirtAddr + (RingPtr->Separation * BdCount) - 1)) {

xdbg_printf(XDBG_DEBUG_ERROR, "BdRingCreate: BD space cross "
"0x0\r\n");

return XST_DMA_SG_LIST_ERROR;
}

bd_dma_part.JPG
address mappings.JPG
0 Kudos
Xilinx Employee
Xilinx Employee
15,583 Views
Registered: ‎08-02-2011

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution
Yeah, your SG engine only sees addresses 0xC0000000 to 0xC0001FFF so 0x00000000 is no good. The SG engine is going to go out and fetch BDs based on the mapping for the SG interface.

Oh yeah, don't worry about virtual addresses. That's only if you're running, say, linux which uses virtual memory for apps. Just use the addresses found in the address editor.
www.xilinx.com

View solution in original post

0 Kudos
Visitor geledek
Visitor
9,704 Views
Registered: ‎04-11-2014

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution
I see. A NXTDESC register of a descriptor is has only [31:6] thats 24 bits. Can 0xC000040 be passed into the next descriptor pointer register?
0 Kudos
Xilinx Employee
Xilinx Employee
9,698 Views
Registered: ‎08-02-2011

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution
Yeah, that should work. From the doc:

"Descriptors must be 16 word aligned, that is, 0x00, 0x40, 0x80 and others. Any other alignment has undefined results."
www.xilinx.com
0 Kudos
Visitor geledek
Visitor
9,687 Views
Registered: ‎04-11-2014

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution

Yes it works now. Thanks a lot!

0 Kudos
Voyager
Voyager
4,245 Views
Registered: ‎10-31-2016

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution

Hi, 

Is it possible to share the project implementation for DMA scatter and gathering with BRAM ? 

Thank you 

0 Kudos
Observer l.sara_tg
Observer
1,290 Views
Registered: ‎09-08-2017

Re: DMA Scatter Gather Mode Error after processing the first descriptor

Jump to solution

Hi @geledek

 

I would like to use AXI_DMA SG with bram control.

 

Could you please share your project or tell me haw I can implement scatter and gather in BRAM?

 

Thanks a lot

 

Sara

0 Kudos