First of all try a higher clock, that's the clock at which PIO instructions run, not the sampling rate.// slow the clock down to 1 Mhz
sm_config_set_clkdiv(&c, 125.0); // set the clock divider so clock runs at 1 MHz
And you need a sampling rate much higher than the minimum signal duration of 1us.
I would go at full speed (125 MHz) and scale the results accordingly.
P.S. Or run the processor and PIO at a clock which is power of 2 (128 MHz) and conveniently do a right shift to get the result in us.
You have to take in account that a sampling cycle is 2 instructions + initial edge detection (negligible at high sampling rate).
In this case you have to divide by 64.
Statistics: Posted by gmx — Tue Dec 10, 2024 6:18 pm