# Max frequency can created by wave function in pigpio library

I want create difference phase between two pulse on GPIO 7 and GPIO 8 as in code but wave display on piscope only have 5us. I tried any way but when difference phase less 5 us is it alway display is 5us as in below figure . The main reason that, I have doubts about ability generate with high freq of wave function in pigpio library. So I tried generate a pulse from 40khz-100khz by using set_dc(GPIO,dc) function in wavePWM1 example is that when freq generated larger 70khzz is pulse generated have wrong frequency as in figure :http://imgur.com/a/XhVKq. please explain about this problem help me. import time import pigpio import wavePWM

   GPIO=[7, 8]

pi = pigpio.pi()

if not pi.connected:
exit(0)

"""
This code demonstrates four different methods of setting
the pulse start and length.
"""
pwm = wavePWM.PWM(pi) # Use default frequency

pwm.set_frequency(40000)

cl = pwm.get_cycle_length()
# Method 2.
pwm.set_pulse_start_and_length_in_micros(7, 10, 12.5)
pwm.set_pulse_start_and_length_in_micros(8, 14, 12.5)
pwm.update() # Apply all the changes.

time.sleep(20)

for g in GPIO:

pwm.set_pulse_length_in_micros(g, 0)

pwm.update()

time.sleep(1)

pwm.cancel()

pi.stop()


piscope uses the services of the pigpio library to provide GPIO timings.

By default pigpio samples the GPIO every 5µs (200 thousand times per second).

The pigpio sample rate is at most once every µs (1 million times per second). You tell pigpio which sample rate to use by a configuration option.

The pigpio daemon uses the -s option to set the sample rate.

To use 1µs sampling start the pigpio daemon with the following command.

sudo pigpiod -s1

• thanks @joan, I have generated with 1us sampling start successfullly. I have a question for you if I want start time have resolution about 0.5us is your new class can do thing? seem it only can generate to 1us is smallest? – Gab Oct 10 '16 at 2:27
• The resolution of pigpio waves is 1µs. You could alter the code to increase the resolution but it will not be trivial to do so and it is not something I will do. I believe that there will be too much timing jitter with sub-microsecond pulses. – joan Oct 10 '16 at 7:59

You can get 24(100) times better than 1us (24Msps/100Msps) for 5$(26$) with free shipping, I have both and they work well: https://www.aliexpress.com/item/1Pcs-New-Arrival-USB-Logic-Analyze-24M-8CH/32499647340.html

https://www.aliexpress.com/item/USB-Logic-Analyzer-100M-max-sample-rate-16Channels-10B-samples-MCU-ARM-FPGA-debug-tool/32285979458.html

Hermann.

P.S: I did create 41.67MHz with Pi Zero PWM (verified with above 100Msps logic analyzer) and learned from others that even higher frequencies can be generated: www.raspberrypi.org/forums/viewtopic.php?t=157907&p=1027501

• USB logic Analyzer 100M max sample rate 16CH that can support for we library or sofware to us can verify depends on our goal use? – Gab Oct 11 '16 at 2:05