2009-07-15 15:03:33     SPORT I/O Speeds

Document created by Aaronwu Employee on Aug 16, 2013
Version 1Show Document
  • View in full screen mode

2009-07-15 15:03:33     SPORT I/O Speeds

Matthew Barousse (UNITED STATES)

Message: 77404   


Hey All,


I have an ADC (AD7683) hooked up to SPORT0 and a DAC (AD5663) hooked up to SPORT1. As a simple system test I'm reading in samples from the ADC and formatting them for the DAC and writing it out to that, sampling a sine wave.


I'm curious though. It seems the fastest I can sample at is just under 1kHz (~925Hz). There's not a whole lot going on in the loop, so I wouldn't imagine it's anything I can improve with code efficiency. Is there anyway I can get my sample rate up around 100k on here? I'm trying to avoid kernelspace development as it's a bit daunting and I'm only an undergrad, but I might have to dive in eventually.


Any input or advice for increasing my sample rate would be amazing, and thanks for your time.


I'm running a BF-537 Stamp Board at 500MHz/100MHz and the 2008R1.5-RC3 release. Here's what's going on inside my loop:




    read(sport0, (void *)buf0, 3); // buf0 and buf1 are unsigned integers


    buf0 = buf0 >> 2; // this cleans up the SPORT data

    buf0 = buf0 & 0xFFFF;


    buf1 = 0x17 + buf0; // adds command bits for DAC


    write(sport1, (void *)buf1, 4);





2009-07-16 11:17:57     Re: SPORT I/O Speeds

Matthew Barousse (UNITED STATES)

Message: 77459   


On further investigation I should have read more. I wrote a simple kernel timer module based on the page at   docs.blackfin.uclinux.org/doku.php?id=linux-kernel:timers


I can trigger a function call inside my module at intervals, but this is inside of my module code. I have a feeling i'm not supposed to handle SPORT read/writes using a driver from in there.. I don't know though. I'm not expirienced with kernelspace development.


Is there a way to get my userspace application that reads/writes to SPORT to interface with that module? Is there a way to go about this?


Thanks alot,






2009-07-16 14:41:07     Re: SPORT I/O Speeds

Mike Frysinger (UNITED STATES)

Message: 77479   


are you using DMA or PIO mode ?  if you're only reading like 4 bytes at a time, i imagine PIO would be less overhead.


i think what you'd like to see is async write support ... if your read blocked, but your write queued data up immediately so that the kernel could process that in the background what your app went back to reading sport0.  for your limited case, hacking that into the kernel should be somewhat easy ...


if you did move to kernel space, you wouldnt be able to use the generic sport drive.  you'd have to write your own sport code.




2009-07-16 15:03:30     Re: SPORT I/O Speeds

Matthew Barousse (UNITED STATES)

Message: 77481   


I'm using PIO. It's 16 bits of data, but the way my ADC is I end up getting 24 into my buffer, and have to do a bit of bitshifting. I'll embed the timing diagram at the bottom of this post, it shows why.


Ok, I thought I wouldn't be able to use the generic driver in my module, but I wasn't sure. I guess I'll end up writing my own sport code into a propper module. I've been doing alot of reading and in the long run it will probably be better than a cheap hack to the kernel. We're going to end up expanding on this useability quite a bit.


Thanks for the help.

AD7683 Timing Diagram