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: 
Highlighted
Visitor chadgentry
Visitor
12,658 Views
Registered: ‎06-09-2014

AXI DMA in Linux Timing Out

Jump to solution

I'm trying to use the example project detailed here on slide 25 with the axidma.c.golden driver posted with that slide.  After Linux boots up, I can see the dma in /sys/bus/platform/devices and /proc/interrupts so I'm assuming they came up correctly. However, when I go to load the compiled driver, it times out waiting for the DMA to finish.  I see these messages in dmesg.

 

AXI DMA module initialized
Starting DMA transfers
Waiting for DMA to complete...
DMA timed out
DMA transfer failure
DMA bytes sent: 32768

I added ILA's to every AXI interface that touches the DMA. It looks like the DMA is configured correctly via the S_AXI_LITE, but none of the AXIS interfaces show any activity. Here's the order:
    1. Set S2MM_DMACR to enable
    2. Set S2MM_DMACR to use interrupts
    3. Set S2MM_DA destination address
    4. Set S2MM_LENGTH to transfer length
    5. Check MM2S_DMASR
    6. Set MM2S_DMACR to enable
    7. Set MM2S_SA source address
    8. Set MM2S_LENGTH to transfer length.

 

This should be all it takes to start off the transfer, but nothing happens.  All the ILA's tied to the data are silent.  I'm attaching the devicetree and a tcl script to build the project.  I'm using the zc706 and Vivado 2014.2.

 

Thanks,

Chad

0 Kudos
1 Solution

Accepted Solutions
Visitor chadgentry
Visitor
19,978 Views
Registered: ‎06-09-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

I got it working.  My problem was initially the interrupt values in the devicetree, but in my debugging, I inadvertantly set the dma's buffer length register to 14 bits (the driver does a 32768 byte transfer, which has zeros for the 14 LSBs).  That explains why the ILAs showed length being written but the DMA wouldn't do anything.

 

I'll go ahead and attach my tcl script and devicetree with the corrected settings.  They should work for Vivado 2014.2.

 

Thanks,

Chad

Tags (1)
0 Kudos
17 Replies
Xilinx Employee
Xilinx Employee
12,634 Views
Registered: ‎09-10-2008

Re: AXI DMA in Linux Timing Out

Jump to solution

Hi Chad,

 

For my testing I typically loop the transmit stream of the AXI DMA back to the receive stream.  Did you do that as the error you're getting sounds like there's nothing connected to the AXI stream of the AXI DMA?  Or do you have something other h/w connected to the streams?

 

Happy New Year,

John

0 Kudos
Visitor xil3s92f
Visitor
12,629 Views
Registered: ‎04-19-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

You mentioned slide 25 but I don't see a link to it. Also you said you were using the axidma.c.golden driver. Why not use the official xilinx_axidma.c driver included in the petalinux kernel?

0 Kudos
Visitor chadgentry
Visitor
12,623 Views
Registered: ‎06-09-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

It's looped back. See the diagram below.

 

Capture.PNG

 

0 Kudos
Visitor chadgentry
Visitor
12,622 Views
Registered: ‎06-09-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

Sorry I forgot to link to the presentation and driver.  The presentation is here and the driver here.  To answer you question, from what I understand about xilinx_axidma.c, it needs another driver to actually be used.  The axidma.c.golden driver supplied in the other forum topic (here) is this driver.  It handles things like setting up the buffers and initializing the transfers.

0 Kudos
Xilinx Employee
Xilinx Employee
12,604 Views
Registered: ‎09-10-2008

Re: AXI DMA in Linux Timing Out

Jump to solution
It looks like you did mimic the system I was testing with.

Yes xilinx_axidma.c is the driver in the kernel and it is used. This driver as you said is a higher layer driver that uses the xilinx_axidma driver thru the Linux DMA Engine API. DMA is very layered in the kernel.

You can use devmem from the Linux console to read/write the registers of the AXI DMA and see what it's doing. I'm not sure how you got the device tree, but the interrupts could be wrong (tx vs rx) and that might also cause this (I don't remember for sure). Just giving ideas on how to debug it.

Thanks
John

0 Kudos
Visitor chadgentry
Visitor
12,517 Views
Registered: ‎06-09-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

I double checked the device tree and my block diagram and did see that the interrupts were wrong, but it still doesn't work.  I added a ILA to the interrupts and they aren't even going high.

 

What's happening is that the DMA pcore is getting configured correctly but it never begins for some reason.  I see no data transferring in my ILAs connected to the AXI bus and the interrupts never go high.  However, when I write the length (S2MM_LENGTH and MM2S_LENGTH) to the DMA pcore myself, the DMAs start working and the interrupts go high.  I even saw the new data in the RAM via /dev/mem.

 

Here are the DMA registers after the driver times out:

S2MM_DMACR (Configure): 0x17003

S2MM_DMASR (Status): 0x1000

S2MM_DA (Destination): 0x16E90000

S2MM_LENGTH (Length): 0x0

 

MM2S_DMACR (Configure): 0x17003

MM2S_DMASR (Status): 0x1000

MM2S_SA (Source): 0x15138000

MM2S_LENGTH (Length): 0x0

 

Given that the driver works for others and how simple this design is, I'm really at a loss at what's going wrong.  It looks the DMA gets configured correctly by the driver, but it doesn't run until I go in and manually write the length.  If you look at my first post, the length definitely gets written by the driver, but it gets set to zero without an interrupt indicating an error.

0 Kudos
Xilinx Employee
Xilinx Employee
12,512 Views
Registered: ‎09-10-2008

Re: AXI DMA in Linux Timing Out

Jump to solution
Can you check to see if the PL330 driver is in the kernel as you would see some messages in the boot log? If so, then remove it. When it's in the kernel then a channel from it can be acquired when no filtering is being used to get a channel.

Thanks
John
Visitor chadgentry
Visitor
12,508 Views
Registered: ‎06-09-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

It was present so I removed it but nothing seems to have changed.  The DMA still behaves incorrectly and manually writing the length to the DMA still initates a successful transfer.

0 Kudos
Visitor chadgentry
Visitor
19,979 Views
Registered: ‎06-09-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

I got it working.  My problem was initially the interrupt values in the devicetree, but in my debugging, I inadvertantly set the dma's buffer length register to 14 bits (the driver does a 32768 byte transfer, which has zeros for the 14 LSBs).  That explains why the ILAs showed length being written but the DMA wouldn't do anything.

 

I'll go ahead and attach my tcl script and devicetree with the corrected settings.  They should work for Vivado 2014.2.

 

Thanks,

Chad

Tags (1)
0 Kudos
Xilinx Employee
Xilinx Employee
8,633 Views
Registered: ‎09-10-2008

Re: AXI DMA in Linux Timing Out

Jump to solution

Thanks for the follow up Chad.  Glad it's working.

0 Kudos
Adventurer
Adventurer
7,667 Views
Registered: ‎05-12-2012

Re: AXI DMA in Linux Timing Out

Jump to solution

>> Can you check to see if the PL330 driver is in the kernel as you would see some messages in the boot log? If so, then remove it.

 

I stuck with the similar problem. And your assumption is worked for me.

0 Kudos
Observer bencai
Observer
7,525 Views
Registered: ‎05-12-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

Hi John and others,

 

It seems when the PL330 drive is loaded, a number of additonal channels are created in 

 

/sys/class/dma

dma0chan0  dma0chan2  dma0chan4  dma0chan6  dma1chan0
dma0chan1  dma0chan3  dma0chan5  dma0chan7  dma1chan1

The wanted DMA channels becomes "dma1chan0" and "dma1chan1", this causes the wrong channel begin requested by the kernal driver (dma_proxy.ko) which results failure. The Xlinix DMA test (axi-dma-test-1.00.a) does't have this issue.

 

What is the best way to overcome this if the PL330 driver is also required?  How do you force the driver to find the right channel?

 

section of devicetree is attached below:

 

        axi_dma_0: axi-dma@40400000 {
             compatible = "xlnx,axi-dma-6.03.a", "xlnx,axi-dma-1.00.a", "xlnx,axi-dma";
            interrupt-parent =  <&intc>;
            interrupts = <0 29 4>, <0 30 4>;
            reg = <0x40400000 0x10000>;
            mm2s-channel@40400000 {
                compatible = "xlnx,axi-dma-mm2s-channel";
                interrupts = <0 29 4>;    /* @61, 61-32 = 29 */
                xlnx,datawidth = <0x40>;  /*64 bits wide*/
                xlnx,device-id = <0x0>;
            } ;

            s2mm-channel@40400030 {
                compatible = "xlnx,axi-dma-s2mm-channel";
                interrupts = <0 30 4>;       /* @62, 62-32 = 30 */
                xlnx,datawidth = <0x40>;   /*64 bits wide*/
                xlnx,device-id = <0x0>;
            } ;
                } ;


        dmac_s: dmac@f8003000 {
            compatible = "xlnx,ps7-dma-1.00.a", "arm,primecell", "arm,pl330";            
            reg = <0xf8003000 0x1000>;
            interrupt-parent = <&intc>;
            interrupt-names = "abort", "dma0", "dma1", "dma2", "dma3",
                "dma4", "dma5", "dma6", "dma7";
            interrupts = <0 13 4>,
                         <0 14 4>, <0 15 4>,
                         <0 16 4>, <0 17 4>,
                         <0 40 4>, <0 41 4>,
                         <0 42 4>, <0 43 4>;
            #dma-cells = <1>;
            #dma-channels = <8>;
            #dma-requests = <4>;
            clocks = <&clkc 27>;
            clock-names = "apb_pclk";
        };

 

Thanks,

Ben

 

0 Kudos
Xilinx Employee
Xilinx Employee
7,494 Views
Registered: ‎09-10-2008

Re: AXI DMA in Linux Timing Out

Jump to solution

Hi Ben,

 

The filter function that can be passed to dma_request_channel() is the way you should be able to do it.

 

https://www.kernel.org/doc/Documentation/dmaengine/client.txt

 

This PPT shows the details pretty well as I did exercise this at one time.  Look for "Requesting A Specific Channel Example".

 

https://forums.xilinx.com/xlnx/attachments/xlnx/ELINUX/10658/1/drivers-session4-dma-4public.pdf

 

Thanks

John

 

0 Kudos
Observer bencai
Observer
7,474 Views
Registered: ‎05-12-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

Of course!  

 

Thank you.

0 Kudos
Explorer
Explorer
3,871 Views
Registered: ‎06-19-2015

Re: AXI DMA in Linux Timing Out

Jump to solution

Hi,

 

I am also facing the same issue of DMA Time out..

 

I have checked my dtsi file, interrupt numbers... Here am attaching my dtsi file, pls suggest me the solution.

 

Thank you

Madhu

0 Kudos
Explorer
Explorer
3,696 Views
Registered: ‎07-17-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

Hi John,

Different Ben here...

I'm looking at this thread and when I checked your links, I've come to find the linux .txt API documentation states:

1. Allocate a DMA slave channel

   Channel allocation is slightly different in the slave DMA context,
   client drivers typically need a channel from a particular DMA
   controller only and even in some cases a specific channel is desired.
   To request a channel dma_request_chan() API is used.

   Interface:
	struct dma_chan *dma_request_chan(struct device *dev, const char *name);

 
Where the examples (including your PDF)

chan = dma_request_channel(mask, filter, (void *)&match);

Did something change? Those 2 methods of call don't look compatible.

Thanks,

 -Ben

0 Kudos
Explorer
Explorer
3,675 Views
Registered: ‎07-17-2014

Re: AXI DMA in Linux Timing Out

Jump to solution

Nevermind -- I see one is

 

dma_request_chan() vs dma_request_channel()

(shaking head)

 

 

0 Kudos