Software PWM minimal frequency #293
Replies: 5 comments
-
PWM software uses the Pigpio library https://abyz.me.uk/rpi/pigpio/index.html That on() method calls gpioSetPWMfrequency in that library. Their doc has a table showing possible frequencies. That details says the 'sample rate' is used to determine the chart value defining minimum freq, apparently the sample rate resulted as 10 the lowest possible . I tested freq of 18 results in the actual freq being 20. I do not see that we support setting the sample rate (gpioCfgClock) All that said, we already recognize the desired software frequency may not be possible : |
Beta Was this translation helpful? Give feedback.
-
So settings even 8kHz isn't possible, because of lack of sample rate setter? |
Beta Was this translation helpful? Give feedback.
-
i assume you mean 8 hz, not 8KHz Correct, appears 8 HZ will have an actual freq of 10 Hz, If you can spare using a hardware PWM it appears to do what you want. I didn't connect a my scanaquad to watch the line but looks like the LED is flashing at that slow rate. |
Beta Was this translation helpful? Give feedback.
-
I meant 8 kHZ. We only achived max 2 kHZ. I think in documentation we found that max we can do 8 kHZ of software pwm |
Beta Was this translation helpful? Give feedback.
-
your test case used 2 Hz, I did not realize you were starting a different question. I would suggest use the step written in the javaDoc to set the freq and inspect its actual value by calling the method'Pwm::getActualFrequency() If actual is 8Khz and signal measurement is far less, I suspect this is what the web pages mentions that soft pwm is not accurate compared to hw pwm. "software version cannot achieve precise or particularly fast frequencies." |
Beta Was this translation helpful? Give feedback.
-
I use 2.3.0 pi4j library and Kotlin and I created pwm config like this:
and I run pwm like this:
pwm.on(4.0, 2)
On osciloscope I found that it generates 10Hz not 2Hz. Why I cannot run pwm for 1-9Hz?
Beta Was this translation helpful? Give feedback.
All reactions