SPI or CSPI transfers using DMA
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=/
A message that is not in the archive (sent off-list or not yet received): 10811398.477881225431989704.JavaMail.nabble-eSX/[email protected]
Quoted 9 lines · [email protected] 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.
Signature · 14 lines
Ned Forrester nforrester-/[email protected] 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=/
Quoted 2 lines · On Thursday 30 October 2008, [email protected]…
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. ;)
Quoted 1 line
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.
Quoted 4 lines
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. :)
Quoted 3 lines
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 ...
Quoted 3 lines
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=/
A message that is not in the archive (sent off-list or not yet received): 200811201339.28627.david-b-yBeKhBN/[email protected]
Quoted 10 lines · David Brownell
Quoted 5 lines · On Thursday 30 October 2008, [email protected]…
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. :-)
Signature · 14 lines
Ned Forrester nforrester-/[email protected] 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=/
A message that is not in the archive (sent off-list or not yet received): 4925ED9B.305-/[email protected]
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-/[email protected]]
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
Quoted 10 lines · David Brownell
Quoted 5 lines · On Thursday 30 October 2008, [email protected]…
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. :-)
Signature · 14 lines
Ned Forrester nforrester-/[email protected] 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=/