linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ned Forrester <nforrester-/d+BM93fTQY@public.gmane.org>
To: magene-5892unH0nlnYtjvyW6yDsg@public.gmane.org
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: SPI or CSPI transfers using DMA
Date: Fri, 31 Oct 2008 08:28:03 -0400	[thread overview]
Message-ID: <490AF9D3.8020401@whoi.edu> (raw)
In-Reply-To: <10811398.477881225431989704.JavaMail.nabble-eSX/vLDKhQvUl7QJpGZvuQ@public.gmane.org>

magene-5892unH0nlnYtjvyW6yDsg@public.gmane.org wrote:
> I've been developing an application on an Eurotech (formerly Applied
> Data Systems) Bitsy Xb PXA270 board that reads data from and ADC at
> about 50 kSamples/sec.  It works fine when I poll the SPI port for
> data but I get some drop outs in the data, probably when the OS is
> off doing something else.  I'd like to use DMA put the DMA engine on
> the PXA270 has a pretty steep learning curve.  Does anyone have a
> code example that could help jumpstart me?  I may be upgrading to a
> i.MX31 based board and similar examples with that device's CSPI and
> DMA would also be helpful.

While it's a driver for a different type of interface (SPI),
drivers/spi/pxa2xx_spi.c uses DMA for TX and RX on the PXA270/255 and
seems to be a good example of setting up DMA and mapping memory for it.

Start with that example and see if it solves your problem.  The main
issue may be that pxa2xx_spi.c uses non-descriptor DMA, and so interrupt
service is still required to set up each DMA transfer, and you could
still miss samples at that point.  I have a similar need for
uninterrupted DMA transfer at 11Mbit/sec, probably about 8 times your
data rate, so I extensively re-wrote pxa2xx_spi.c to use descriptor DMA
chains so that the hardware can run for long periods (1Mbyte of data)
without any service by the CPU.  That code is now working, but it is an
organizational mess, so not really ready for release.

I would also recommend the book "Linux Device Drivers", Corbet, et al.
from O'Reilly.  I would never have figured out the driver without some
reference like that.

-- 
Ned Forrester                                       nforrester-/d+BM93fTQY@public.gmane.org
Oceanographic Systems Lab                                  508-289-2226
Applied Ocean Physics and Engineering Dept.
Woods Hole Oceanographic Institution          Woods Hole, MA 02543, USA
http://www.whoi.edu/sbl/liteSite.do?litesiteid=7212
http://www.whoi.edu/hpb/Site.do?id=1532
http://www.whoi.edu/page.do?pid=10079


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

  parent reply	other threads:[~2008-10-31 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-31  5:46 SPI or CSPI transfers using DMA magene-5892unH0nlnYtjvyW6yDsg
     [not found] ` <10811398.477881225431989704.JavaMail.nabble-eSX/vLDKhQvUl7QJpGZvuQ@public.gmane.org>
2008-10-31 12:28   ` Ned Forrester [this message]
2008-11-20 21:39   ` David Brownell
     [not found]     ` <200811201339.28627.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-20 23:07       ` Ned Forrester
     [not found]         ` <4925ED9B.305-/d+BM93fTQY@public.gmane.org>
2008-11-20 23:46           ` Massion, Gene

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=490AF9D3.8020401@whoi.edu \
    --to=nforrester-/d+bm93ftqy@public.gmane.org \
    --cc=magene-5892unH0nlnYtjvyW6yDsg@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).