Re: [libgpiod] How can I use PWM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy, Kent,

I believe I am on the right track.

I added following line to my config.txt
# enable pwm on pin 18
dtoverlay=pwm,pin=18,func=2

Now I have
# ls /sys/class/pwm/pwmchip0
device  export  npwm  power  subsystem  uevent  unexport
# lsmod|grep pwm
pwm_bcm2835            16384  0

and an example I found is working
https://github.com/jdimpson/syspw


Kind regards
Robert

On Sat, Aug 6, 2022 at 4:04 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Sat, Aug 6, 2022 at 3:40 PM Kent Gibson <warthog618@xxxxxxxxx> wrote:
> > On Sat, Aug 06, 2022 at 12:12:31PM +0200, Andy Shevchenko wrote:
> > > On Fri, Aug 5, 2022 at 1:17 PM Robert Baumgartner <rbaumgar@xxxxxxxxxx> wrote:
>
> ...
>
> > > No, you haven't missed anything except Unix ideology. That ideology is
> > > telling us that one tool for one thing, and in very featurable mode.
> > > That said, lingpiod is exclusively for GPIO ABI between kernel and
> > > user space. For PWM you need to access the PWM ABI in a way how it's
> > > represented by the Linux kernel. I believe there are plenty of
> > > libraries more or less okayish for that purpose, but I never heard
> > > about any official library and/or Python bindings for it.
> >
> > I'm assuming Robert is refering to software PWM.
>
> I don't think so. The article he referenced clearly tells about two
> (hardware!) PWMs.
>
> > AFAIAA Rpi.GPIO doesn't
> > support hardware PWM, and the referenced article also refers to software
> > PWM for the Python case.
> >
> > libgpiod doesn't directly support software PWM, but it is fairly
> > straight forward to implement yourself using libgpiod.
>
> Hmm... I was under the impression that we have pwm-gpio in the
> kernel... Can't find quickly if there is one.
>
> --
> With Best Regards,
> Andy Shevchenko
>




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux