From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ned Forrester Subject: Re: SPI or CSPI transfers using DMA Date: Fri, 31 Oct 2008 08:28:03 -0400 Message-ID: <490AF9D3.8020401@whoi.edu> References: <10811398.477881225431989704.JavaMail.nabble@isper.nabble.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: magene-5892unH0nlnYtjvyW6yDsg@public.gmane.org Return-path: In-Reply-To: <10811398.477881225431989704.JavaMail.nabble-eSX/vLDKhQvUl7QJpGZvuQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.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=/