pidood1234
Posts: 5
Joined: Thu Jan 02, 2020 6:04 am

pigpio software PWM jitters when run together with raspivid

Mon Jan 06, 2020 5:40 pm

I’m trying to run software PWM using the pigpio library to generate software PWM. Individually without running raspivid , the spftware works and I can spin a brushless motor. However when I turn on raspivid, the software PWM jitters — specifically, the software PWM is actually output at about 10% which is enough to spin the motor even though I did not output anything from my software. Any clues as to whats causing this?

pidood1234
Posts: 5
Joined: Thu Jan 02, 2020 6:04 am

Re: pigpio software PWM jitters when run together with raspivid

Mon Jan 06, 2020 5:42 pm

Specifically, raspivid is run in a separate ssh session (headless) , and my pigpio software is run on another ssh session also. The hardware used is raspi zero w. OS used is the latest raspbian.

User avatar
joan
Posts: 14553
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: pigpio software PWM jitters when run together with raspivid

Mon Jan 06, 2020 5:55 pm

Presumably there is a conflict. Have you tried starting pigpio with the PWM clock rather than the PCM clock (or vice versa). See the -t option at http://abyz.me.uk/rpi/pigpio/pigpiod.html

If it's not that then perhaps there is a clash with DMA channel usage. I know nothing about raspivid and don't know if it uses DMA. If it does again see -d -e http://abyz.me.uk/rpi/pigpio/pigpiod.html to select a different DMA channel.

pidood1234
Posts: 5
Joined: Thu Jan 02, 2020 6:04 am

Re: pigpio software PWM jitters when run together with raspivid

Thu Jan 16, 2020 5:11 pm

I tried updating the clock source between PWM and PCM, but the issue still persists.

Also tried changing up the different channels for DMA primary and secondary channels, also have the same issue.

One condition that worked sometimes is that raspivid does not trigger the software PWMs, but what ends up happening is when I try to exit out of my code and call gpioTerminate(), the program never returns, i.e. it's stuck and does not even respond to a Ctrl+C. When I rerun gpioInitialize(), it turns up with the error

Code: Select all

cannot lock /var/run/pigpio.pid
, so I have to power cycle the pi, and then the raspivid will interfere with PWM again. Any idea what's causing this loop above to hang?

User avatar
joan
Posts: 14553
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: pigpio software PWM jitters when run together with raspivid

Thu Jan 16, 2020 6:03 pm

I don't know what is happening.

You can delete the pid file so you don't need to reboot.

sudo rm /var/run/pigpio.pid

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7707
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: pigpio software PWM jitters when run together with raspivid

Fri Jan 17, 2020 2:06 pm

Which GPIOs are you using?

How busy is the CPU when running both apps?
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Troubleshooting”