I need to generate a 500Hz PWM with a duty cycle from about 5% (100uS) to 100% (2mS) on a Legato system to output on a GPIO.
I’ve tried using the Legato GPIO service and a timer, but it’s just not fast enough. The bottleneck appears to be in the GPIO service - according to my oscilloscope, the following piece of code:
takes between 600 and 900uS (horrible jitter). I suspect that this is because the underlying Legato GPIO control is actually done via file system read/write into /sys/class/gpio/gpioN, rather than touching the underlying hardware directly. And there appears to be an overhead of around 2.2mS between timer invocations.
Is there any way to generate a PWM signal on a GPIO in hardware?