NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: PWM GPIO on Raspberry Pi 3
Benny Siegert <bsiegert%gmail.com@localhost> writes:
> Hi!
>
> I added a 5V PWM fan to my RPi 3 running 10.1 in 32 bit mode, as
> earmv7hf. I connected the PWM control pin to GPIO18, as per the article
> in
> https://blog.driftking.tw/en/2019/11/Using-Raspberry-Pi-to-Control-a-PWM-Fan-and-Monitor-its-Speed/.
>
> The thing is, I can only switch the fan on and off from there. I'd like
> to use the actual PWM facility to run it at lower speeds.
>
> How is PWM GPIO supposed to work? I found a thread from 2019 that
> suggests that the hardware PWM on the RPi3 would need driver support
> that we do not have.
>
> For software PWM, I tried this command that I found in the manpage:
>
> gpioctl gpio0 attach gpiopwm 18 1
>
> which results in "invalid argument".
>
> I think the gpiopwm driver is not loaded, but there doesn't seem to be a
> module for it either.
>
> Any hints?
You will have to compile your own kernel for that driver because as you
have found, it doesn't exist as a module. The man page for gpiopwm does
suggest the lines that would need to be added to a kernel config file.
It could be something as simple as this (assuming you are using
earmv7hf, if you are using earmv6hf use RPI2 on the include line):
----
include "arch/evbarm/conf/GENERIC"
gpiopwm* at gpio? offset 18 mask 1
----
Related to this... in the next couple or maybe few months I will
probably be committing drivers for the EMC-210x and EMC-230x fan
controller chips (at least some, if not most, of the members of those
families). At least for the EMC-2101 a breakout board that is
reasonability priced exists from Adafruit. Those will allow hardware
fan PWM control and tach, and probably some temperature stuff, for
anything that can do I2C.
--
Brad Spencer - brad%anduin.eldar.org@localhost
Home |
Main Index |
Thread Index |
Old Index