From: Dave H. <dhy...@gm...> - 2009-08-28 04:12:42
|
Hi Matt, On Thu, Aug 27, 2009 at 8:53 PM, Matthew Bowles<ma...@aw...> wrote: > Hi everyone > > I have got the GPIO access working in C. I did use fputs() instead of > fwrite() just to simplify things, but what I am getting is a 50mS lag > between. that is, the following code: > > fputs("GPIO out set",pGPIO_TxRx); > fflush(pGPIO_TxRx); > fputs("GPIO out clear",pGPIO_TxRx); > fflush(pGPIO_TxRx); > > produces a trace with a +ve edge, followed by a delay of 48.4mS, and then a > -ve edge. > obviously there's some kernel polling of file-system writes or something. I > assumed it would be near instaneous and I need it to be within 3-5 mS. Using the gpregs technique will give you much faster changes. >From the archives: <http://article.gmane.org/gmane.linux.distributions.gumstix.general/7329> somebody got was able to write to a GPIO pin at about 6 MHz from user space. The "modified pxaregs" is essentially the same technique used by gpregs. Note: not a significant contributor, but the printk done by the kernel when you do the above adds a little more than 3 msec to the time. -- Dave Hylands Shuswap, BC, Canada http://www.DaveHylands.com/ |