linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SPI or CSPI transfers using DMA
@ 2008-10-31  5:46 magene-5892unH0nlnYtjvyW6yDsg
       [not found] ` <10811398.477881225431989704.JavaMail.nabble-eSX/vLDKhQvUl7QJpGZvuQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: magene-5892unH0nlnYtjvyW6yDsg @ 2008-10-31  5:46 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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.

Thanks - Gene 

-------------------------------------------------------------------------
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=/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SPI or CSPI transfers using DMA
       [not found] ` <10811398.477881225431989704.JavaMail.nabble-eSX/vLDKhQvUl7QJpGZvuQ@public.gmane.org>
@ 2008-10-31 12:28   ` Ned Forrester
  2008-11-20 21:39   ` David Brownell
  1 sibling, 0 replies; 5+ messages in thread
From: Ned Forrester @ 2008-10-31 12:28 UTC (permalink / raw)
  To: magene-5892unH0nlnYtjvyW6yDsg
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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=/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SPI or CSPI transfers using DMA
       [not found] ` <10811398.477881225431989704.JavaMail.nabble-eSX/vLDKhQvUl7QJpGZvuQ@public.gmane.org>
  2008-10-31 12:28   ` Ned Forrester
@ 2008-11-20 21:39   ` David Brownell
       [not found]     ` <200811201339.28627.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: David Brownell @ 2008-11-20 21:39 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: magene-5892unH0nlnYtjvyW6yDsg

On Thursday 30 October 2008, magene-5892unH0nlnYtjvyW6yDsg@public.gmane.org wrote:
> I've been developing an application on an Eurotech (formerly
> Applied Data Systems) Bitsy Xb PXA270 board

And there I thought "bitsy" was an SA-1100 board from Digital.  ;)


> that reads data from and ADC at about 50 kSamples/sec. 

So about 20 usec per sample ... that's a bit much for a
non-dedicated chunk of hardware.  You didn't describe
the ADC involved; at that rate the details matter.
(Does it constantly sample, or do you need to issue a
command for each sample and play with chipselect?)

If you need timestamps on your samples, I'd plan to
avoid current general purpose frameworks on Linux.
They're not geared towards that sort of design.


> 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. 

Probably.  :)


> 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? 

Our resident expert from Woods Hole has a similar data
streaming application, using PXA and DMA.  Maybe he can
share a few words of wisdom ... 


> I may be upgrading to a i.MX31 
> based board and similar examples with that device's CSPI and DMA
> would also be helpful.         

I don't know what application you're looking at, but
with some of them it might be advantageous to dedicate
a microcontroller to collecting and timestamping your
samples, then writing them into memory (an SRAM?).

Then the PXA (or i.MX) could pull them out on a more
leisurely schedule, preprocess in bulk, etc.

- Dave

-------------------------------------------------------------------------
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=/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SPI or CSPI transfers using DMA
       [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>
  0 siblings, 1 reply; 5+ messages in thread
From: Ned Forrester @ 2008-11-20 23:07 UTC (permalink / raw)
  To: David Brownell
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	magene-5892unH0nlnYtjvyW6yDsg

David Brownell wrote:
> On Thursday 30 October 2008, magene-5892unH0nlnYtjvyW6yDsg@public.gmane.org wrote:
>> I've been developing an application on an Eurotech (formerly
>> Applied Data Systems) Bitsy Xb PXA270 board
>> 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? 
> 
> Our resident expert from Woods Hole has a similar data
> streaming application, using PXA and DMA.  Maybe he can
> share a few words of wisdom ...         

I already did, on 10/31/08.  I have not heard back.  While I referenced
pxa2xx_spi.c as a useful example of setting up DMA, Gene should note
that we recently discovered that the RX and TX DMA memory mappings are
performed in the wrong order in that code.

Interesting... I did not note before that Gene is at MBARI, one of our
sister oceanographic research facilities.  :-)

-- 
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=/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SPI or CSPI transfers using DMA
       [not found]         ` <4925ED9B.305-/d+BM93fTQY@public.gmane.org>
@ 2008-11-20 23:46           ` Massion, Gene
  0 siblings, 0 replies; 5+ messages in thread
From: Massion, Gene @ 2008-11-20 23:46 UTC (permalink / raw)
  To: Ned Forrester, David Brownell
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

David & Ned

I did get Ned's earlier e-mail.  It was of some help although at this time we are looking at upgrading to a board with USB2.0 so we can write to disk faster.  We are currently evaluating an iMX31 board from Logic Product Development.

I'm a little hesitant to admit it but I'm working in Windows CE.  This is kind of an experiment since all the software types at MBARI are committed Linux followers.  Since I'm not really a software guy, no one really cares what I do.  It turns out that Freescale has developed a WinCE driver for the iMX31 that uses DMA as the default.  I'll be looking at how hard it is to include that driver in the LogicPD BSP in the near future.  

Thanks for your input and if you're interested, let me know and I'll let you know how my WinCE experiment turns out.

Cheers

Gene Massion
Monterey Bay Aquarium Research Institute
7700 Sandholdt Road
Moss Landing, California 95039
831 7751922 (tel)
831 7751646 (fax) 

-----Original Message-----
From: Ned Forrester [mailto:nforrester-/d+BM93fTQY@public.gmane.org] 
Sent: Thursday, November 20, 2008 3:07 PM
To: David Brownell
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org; Massion, Gene
Subject: Re: [spi-devel-general] SPI or CSPI transfers using DMA

David Brownell wrote:
> On Thursday 30 October 2008, magene-5892unH0nlnYtjvyW6yDsg@public.gmane.org wrote:
>> I've been developing an application on an Eurotech (formerly
>> Applied Data Systems) Bitsy Xb PXA270 board
>> 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? 
> 
> Our resident expert from Woods Hole has a similar data
> streaming application, using PXA and DMA.  Maybe he can
> share a few words of wisdom ...         

I already did, on 10/31/08.  I have not heard back.  While I referenced
pxa2xx_spi.c as a useful example of setting up DMA, Gene should note
that we recently discovered that the RX and TX DMA memory mappings are
performed in the wrong order in that code.

Interesting... I did not note before that Gene is at MBARI, one of our
sister oceanographic research facilities.  :-)

-- 
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=/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-11-20 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).