e_dma_start always returns -1

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

e_dma_start always returns -1

Postby eoghanoh » Mon Mar 03, 2014 11:08 pm

Hello,

I was wondering if anybody had a couple of minutes to look an issue I'm seeing.

As part of my larger application I'm trying to use DMA. But DMA is always giving me a result of E_ERR (-1), which indicates it has failed (!=0). The manual says it will return 0 if it was successful.

However, it seems to have worked anyway so I'm not sure why it's giving me -1.

And in fact, looking at the SDK source code, I don't see how it could even do the DMA bit and get the right results but still return -1: https://github.com/adapteva/epiphany-li ... ma_start.c

I'm trying to debug my large program and am just trying this small bit separately in an effort to isolate this and understand it and whether or not it's an issue and might be causing some other stuff I'm seeing.

I notice that in the samples the return value is never checked (not in any samples I've seen anyway). Is this safe to ignore or has something gone wrong?

In the program each core just sends the "logical core id" to those cores above and below it so it's a fairly simple example. There's a lot of printf stuff in there. I compiled with -O3 and -DNDEBUG and -DPRINT

The xlseep function is just to kill time to allow the DMA to finish (will do something nicer later).

The cores are 0 to N, and above means numerically above; below means numerically below. Anything received from a core below will be in the 10000 range, anything received from above will be in the 20000 range. The hundreds indicates the number of iterations and the tens and ones indicates the sending core.

Adjust the iterations variable to run more loops - it seems to be OK even repeatedly.

(As a little thankyou for looking at it you'll also see a nice way that I can effectively print to the console in release mode - I find this useful. This slows it down of course but if I'm printing I'm not concerned with speed - when compiling for speed I leave out -DPRINT. Plus......I've implemented my own (slow but thread-safe) memory barrier for debugging in eclipse - needed for eclipse because the projects are run separately, not in a workgroup. It's quick and dirty but it works for basic programs with a single workgroup).

If anybody has seen this issue (or can see a problem with my code) then I'd appreciate it if you could let me know.

Thanks,
Eoghan.
Attachments
dma.zip
DMA Program Source Code
(8.62 KiB) Downloaded 1077 times
eoghanoh
 
Posts: 23
Joined: Mon Dec 17, 2012 3:22 am

Re: e_dma_start always returns -1

Postby aolofsson » Wed Mar 05, 2014 11:43 pm

Eoghan,

Have you taken a look at the the dma examples in the 'epiphany-examples' directory? With the Epiphany and Parallella it will always be safest to stay as close to working examples as possible. Otherwise you may unfortunately find yourself in unchartered waters.

https://github.com/adapteva/epiphany-ex ... _2d_test.c

Can you report back the values in the descriptors just to make sure..

Andreas
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: e_dma_start always returns -1

Postby eoghanoh » Thu Mar 06, 2014 11:24 pm

Hi Andreas,

thanks for the reply. I have taken the 2d demo you suggested and modified it very slightly to store and later print the return code of the e_dma_start calls. I haven't modified anything else whatsoever - the code changes are minimal.

The results are the same as in my own program.

In every case it appears as though the dma works, but the return code is -1 which is E_ERR.

The files are attached.

So it seems that either the manual is incorrect (it says e_dma_start will return 0 on success) or the dma_2d demo is broken.

I've spent a lot of time trying to work this out so would appreciate any help you can offer.

Thanks,
Eoghan.
Attachments
dma_2d_printing_result.zip
2d demo printing e_dma_start return code
(3.23 KiB) Downloaded 1058 times
eoghanoh
 
Posts: 23
Joined: Mon Dec 17, 2012 3:22 am

Re: e_dma_start always returns -1

Postby timpart » Fri Mar 07, 2014 7:01 pm

Have you got the most recent version of e_dma_start compiled in your system? The oldest version (February 2013) had the two parameters the other way around and returns -1 if the first parameter isn't 0 or 1. Not sure how it would manage to do the DMA though as the check comes first. The parameters went to their current order in July 2013.

Tim
timpart
 
Posts: 302
Joined: Mon Dec 17, 2012 3:25 am
Location: UK

Re: e_dma_start always returns -1

Postby eoghanoh » Fri Mar 07, 2014 10:38 pm

Hi timpart,

thanks for the reply.

I'm using SDK 5.13.07.10, which I presume is the July one. And if I go to the header file it shows the function with the parameters in the order I am passing them in i.e. the descriptor and then the channel.

Did you download the attached code and try it? I presume it's the same for you? The code is just the demo app with a tiny bit of extra code to print the return code of the function call.

Thanks,
Eoghan.
eoghanoh
 
Posts: 23
Joined: Mon Dec 17, 2012 3:22 am

Re: e_dma_start always returns -1

Postby aolofsson » Fri Mar 07, 2014 11:07 pm

Eoghan,
I would definitely recommend moving to the latest SDK shown below just in case...we will try to update with a cross SDK as soon as possible.
ftp://ftp.parallella.org/esdk/esdk.5.13 ... armv7l.tgz
Thanks,
Andreas
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: e_dma_start always returns -1

Postby ysapir » Sat Mar 08, 2014 3:23 am

E_ERR and E_OK have the same value in the older release as well. Weird.

Update: the e_dma_start() return value seems to be the same all the way back to the first commit of this file (although with explicit numbers rather than defined symbols).
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm

Re: e_dma_start always returns -1

Postby eoghanoh » Sat Mar 08, 2014 2:26 pm

Hi,

I just wanted to let you know that with SDK 5.13.09.10 it's now returning 0 for success. Didn't change a single byte of code, just recompiled. So that is good news.

I was just using what was on the latest SD image (from December), but I see there is actually a new image available now with presumably this SDK.

Yes, a cross compile SDK of this version would be great.

Thanks for the help everyone.

Eoghan.
eoghanoh
 
Posts: 23
Joined: Mon Dec 17, 2012 3:22 am

Re: e_dma_start always returns -1

Postby aolofsson » Sat Mar 08, 2014 2:30 pm

Eoghan, Fantastic news!

Sorry for not being able to support you with more direct help. Glad that the update worked. I have scrubbed the ftp site so hopefully this won't happen again. Working hard to make sure we get everything is solid as we can for the horde of Kickstarter backers about to power up the boards. I recommend burning a new SD card: http://parallella.org/create-sdcard That way you will get the COPRTHR/OpenCL pre-configured as well!

Andreas
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 12 guests

cron