After I realized that using wiringPi these commands produce a >50µs length pulse, wiringPi was no option.
Code: Select all
...
digitalWrite (13, LOW) ;
digitalWrite (13, HIGH) ;
digitalWrite (13, LOW) ;
...
I found many postings wrt pigpio and (nanosecond) pulse generation.
Solution was simple, turn on 10Hz hardware PWM on GPIO13, wait 0.8ms and then turn off PWM on GPIO13:
Code: Select all
$ cat pulse.c
/*
gcc -o pulse pulse.c -lpigpio -lrt
sudo ./pulse d (0.1µs steps)
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pigpio.h>
int main(int argc, char *argv[])
{
int d = (argc<2) ? 25 : atoi(argv[1]);
if (gpioInitialise() < 0) return 1;
gpioHardwarePWM(13, 10, d);
usleep(800);
gpioHardwarePWM(13, 0, 0);
gpioTerminate();
}
$
Resolution of pulse length is 0.1µs, I did a short test after starting 100Msps logic analyzer:
Code: Select all
$ for((d=1; d<=20; ++d)); do sudo ./pulse $d; done
Then I exported the measured data, imported .csv into Libre office calc, did some work and finally got these pulse lengths in µs:
Code: Select all
0.17
0.31
0.43
0.54
0.64
0.75
0.84
0.93
1.05
1.13
1.23
1.33
1.43
1.53
1.64
1.73
1.83
1.93
2.04
As you can see there is no measured pulse for "1" argument (0.1µs), but for 0.2µs-2µs there are.
Not totally perfect, but I can live with sub 0.1µs imprecision.