My code is a bit sloppy. I keep reopening the and closing the file rather than using a lseek().
Using lseek() is about the same speed as the python. On Monday, August 10, 2020 at 2:40:06 PM UTC-4 John Allwine wrote: > How is the toggling rate slower in C than in Python when using sysfs? That > seems strange to me. > > On Mon, Aug 10, 2020 at 12:31 PM Mark A. Yoder <[email protected]> > wrote: > >> Interesting... Why go through all the trouble to set bits on a chip by >> chip basis, and then end up setting them in a loop? >> >> Here are the toggling standings. >> c via sysfs: 3kHz >> python via sysfs: 6KHz >> c via gpiod: 300KHz >> >> Now to get python via gpiod to work. >> >> --Mark >> On Monday, August 10, 2020 at 2:19:27 PM UTC-4 Dennis Bieber wrote: >> >>> On Mon, 10 Aug 2020 08:33:55 -0700 (PDT), in >>> gmane.comp.hardware.beagleboard.user "Mark A. Yoder" >>> <[email protected]> wrote: >>> >>> >Interesting.... I wrote a c version >>> >< >>> https://github.com/MarkAYoder/BeagleBoard-exercises/blob/master/gpiod/bulk.c> >>> >>> and >>> >the pins are toggle *at the exact same time*. Now, how to get gpioset >>> to >>> >work correctly. >>> > >>> >>> It doesn't seem to use the same/direct calls... I've tracked it down to >>> the function at line 661 >>> https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/lib/core.c >>> and macro definition at line 778 >>> >>> https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/include/gpiod.h >>> >>> which seems to define a loop operation. >>> >>> >>> -- >>> Dennis L Bieber >>> >>> -- >> 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/29db35f1-9022-453e-8966-1a75da8512d4n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beagleboard/29db35f1-9022-453e-8966-1a75da8512d4n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/e727f6da-fbe3-495a-92ee-736e182ee605n%40googlegroups.com.
