Comments (7)
At the moment changing one channel will cause a glitch on the other channel if it is also transmitting PWM.
I'll have a look at the datasheet to see if the glitch can be prevented.
from pigpio.
I changed the title to more accurately reflect the actual behaviour.
I have been more intelligent in the way I set up the channels which means this should no longer happen.
The fix will be in V52 (when it is released).
from pigpio.
Ok. I'll be waiting for V52. I'll give you feedback when I try it.
Thank you very much! I really apreciate your fast support!
from pigpio.
If you want to give it a try you could apply the following patch to V51 of pigpio.c.
Save as patch.txt and then
patch pigpio.c patch.txt
--- pigpio.c-V51 2016-04-26 17:42:48.539091253 +0100
+++ pigpio.c 2016-04-26 16:51:39.450230475 +0100
@@ -25,7 +25,7 @@
For more information, please refer to <http://unlicense.org/>
*/
-/* pigpio version 51 */
+/* pigpio version 52 */
/* include ------------------------------------------------------- */
@@ -1144,6 +1144,7 @@
static uint32_t reportedLevel = 0;
static int waveClockInited = 0;
+static int PWMClockInited = 0;
static volatile gpioStats_t gpioStats;
@@ -7551,6 +7552,7 @@
DBG(DBG_STARTUP, "");
waveClockInited = 0;
+ PWMClockInited = 0;
clock_gettime(CLOCK_REALTIME, &libStarted);
@@ -8958,6 +8960,7 @@
stopHardwarePWM();
initClock(0); /* initialise secondary clock */
waveClockInited = 1;
+ PWMClockInited = 0;
}
p = rawWaveCBAdr(waveInfo[wave_id].topCB);
@@ -9194,6 +9197,7 @@
stopHardwarePWM();
initClock(0); /* initialise secondary clock */
waveClockInited = 1;
+ PWMClockInited = 0;
}
dmaOut[DMA_CS] = DMA_CHANNEL_RESET;
@@ -11413,11 +11417,16 @@
old_PWM_CTL = pwmReg[PWM_CTL] &
(PWM_CTL_PWEN1 | PWM_CTL_MSEN1 | PWM_CTL_PWEN2 | PWM_CTL_MSEN2);
- pwmReg[PWM_CTL] = 0;
+ if (!PWMClockInited)
+ {
+ pwmReg[PWM_CTL] = 0;
- myGpioDelay(10);
+ myGpioDelay(10);
- initHWClk(CLK_PWMCTL, CLK_PWMDIV, CLK_CTL_SRC_PLLD, 2, 0, 0);
+ initHWClk(CLK_PWMCTL, CLK_PWMDIV, CLK_CTL_SRC_PLLD, 2, 0, 0);
+
+ PWMClockInited = 1;
+ }
if (pwm == 0)
{
from pigpio.
Clean compilation and works perfectly! This was a blocking issue for me and now I can continue with my project!
Thank you very much!
from pigpio.
Okay. Unless I hear otherwise I'll close this as an issue when I release V52.
from pigpio.
V52 released.
from pigpio.
Related Issues (20)
- i2c (am2320) works with pigpio and not pigpiod - could definition of i2c_open() be wrong?
- C pigpio timer inaccuracy on raspbery pi 4 with raspian
- Pigpio BB Serial Read CPU Resource vs. RPI version HOT 4
- Is there a way to flush an open gpioSerialRead buffer? HOT 9
- event_callback with 0 bytes
- Issue with pigpio Initialization on Raspberry Pi 5 Model B HOT 1
- Understanding pigpiod command implementation HOT 9
- Glitch filter active while doing bbSerialRead? HOT 3
- SPI Slave - BSCX not consistently working RPi4B HOT 6
- i2c_open() returns the same handle for two devices on the same bus HOT 37
- Scheduling repetitive SPI writes HOT 3
- Isr doesn't work on raspberry os 12.5 HOT 3
- Continuous Wave Program Concept HOT 6
- SPI6 mode 3 HOT 1
- Leave CS low HOT 1
- Pigpio stuck on activating HOT 4
- Adding new functions to the library HOT 2
- Missed packets using RaspberryPi and nRF24L01. HOT 8
- Python 3.11.2 is installed but still getting "Depends: python:any (>= 2.7~) but it is not installable" HOT 2
- gpioSetISRFunc error -123 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pigpio.