A few things about your code.

First, if you're concerned about performance, you're using the wrong
language. Wrong type of a language for that matter. You should be using C,
C++, or ASM. *IF* you're concerned about performance.

Secondly, calling a time() related function in your main loop, every
iteration will slow your code down.

Thirdly printing to stdout every iteration of your loop will slow your
application down A LOT.

Lastly, I'm not sure if the bbio library uses sysfs for manipulating pins
or not. But if it does. There are performance limitations associated with
this as well.

On Tue, May 9, 2017 at 6:00 AM, <[email protected]> wrote:

> hello to every one,here is Yangyang.I want to know,how can test the
> polling-frequency of I/O-port on beaglebone black,and what is the maximum
> speed of the frequency ? The max. speed what I test is around 27kHz. Hope
> there is anyone can help me
> contact via [email protected]. Thanks.
>
> Here is my code(python):
>
> from bbio import *
> import time
>
> testIO = GPIO1_28    #P9_12
> testVar = 0
>
> counter  = 0
> cntMax = 10000
> startTiME = time.time()
> endTiME = 0
>
> pinMode(testIO, INPUT)
>
> while 1:
>     if counter >= cntMax:
>         endTiME = time.time()
>         print 'Frequenz an test IO:', cntMax / (endTiME - startTiME)
>         counter = 0
>         startTiME = time.time()
>     else:
>         if not digitalRead(testIO) == testVar:
>             testVar = not testVar
>             counter += 1
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/beagleboard/72ede135-3c68-4410-8462-83ebeaee6020%40googlegroups.com
> <https://groups.google.com/d/msgid/beagleboard/72ede135-3c68-4410-8462-83ebeaee6020%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CALHSORory4aZ5bDp-v81UpZdkdzwkhtEdiRi%3DVVrEx4WFOwdCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to