Using C code and the inotify interface, I was able to capture GPIO pulses on "/sys/devices/platform/ocp/44e07000.gpio/gpio/gpio26/value" up to 20kHz. It would be nice to use the eCAP registers though. Thanks for the feedback.
On Friday, December 15, 2017 at 2:25:57 PM UTC-6, Dennis Lee Bieber wrote: > > On Fri, 15 Dec 2017 09:05:30 -0800 (PST), > [email protected] <javascript:> declaimed the > following: > > >I would like to use the eCap feature to measure the frequency of a square > >wave, preferably with Python. I see examples for generating a square > wave > >using the BBIO.PWM module but I can't find anything for reading the eCap. > > >The BBIO.Encoder module looks promising. Can I use this to measure the > >frequency of a single square wave or do I need a quadrature encoder? > >Thanks. > > Which "BBIO"? PyBBIO or Adafruit_BBIO? > > Based upon the documentation for the latter -- it is not a > "frequency" > measurement but a counter (up/down) based upon the transitions of a > quadrature signal (ie; TWO square waves 90 deg out of phase). PyBBIO docs > look to be similar. > > A quick Google seems to lean towards either kernel module with > interrupts on GPIO pins, or using the PRU for a tight-loop counter, if > accuracy is needed. > > If some irregularity is acceptable, user-mode GPIO loop may be > okay -- > though probably by memory mapping the GPIO pins rather than using the sys > filesystem access. And both of these will likely not be fast enough if > using interpreted Python. > > Unfortunately, the PWM modules in the Python libraries are > designed > solely for PWM output -- even though the eCAP hardware is part of the PWM > hardware. cf: TRM SPRUH73P section 15.3.3.1 > > https://e2e.ti.com/support/embedded/linux/f/354/t/399439 seems to imply > the > eCAP could be accessible via the sys filesystem (but may need some work). > That could make the latency issue moot, if you can trigger a one-shot > capture (for four time-stamps?) and then read the time-stamps later to > compute frequency. OTOH, > https://e2e.ti.com/support/arm/sitara_arm/f/791/p/393325/1388948 implies > the kernel doesn't support eCAP... > > -- > Wulfraed Dennis Lee Bieber AF6VN > [email protected] <javascript:> HTTP://wlfraed.home.netcom.com/ > > -- 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/bfb36da0-94f4-47d7-9fba-c5abaa17c473%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
