How to read PWM in BBB GPIO…?
I need to 40kHz frequency read in BBB gpio…count frequency & find PWM With…?
How to read PWM in BBB GPIO…?
I need to 40kHz frequency read in BBB gpio…count frequency & find PWM With…?
You don’t need GPIOs. Instead analyse the pulse train by hardware. The eCAP modules in the PWMSS subsystems are designed for that purpose. The simplest (and most powerful) solution is to use libpruio. Check out the example pwm_cap.
BR
So to do that we need to put the Pin PR1_ECAP0_ECAP_CAPIN_APWM_O
in input mode.
Where can we find the source code of the libpruio doing that in the pru ?
libpruio doesn’t use PR1_ECAP0_ECAP_CAPIN_APWM_O pin configuration. Instead it uses the eCAP modules in the PWMSS-[0-2] subsystems (via OCP, not the PRU eCAP). And it doesn’t do pinmuxing directly, but uses the driver pinmux_single by the device tree overlay libpruio.dtbo to put the pins in the matching mode.
Find all the source code in the package (as in the above links).
BR