neggles / cm4io-fan

CM4 IO board PWM fan controller driver
GNU General Public License v2.0
79 stars 17 forks source link

3007 Cooling Fan dont spin on PoE Board using PWM #17

Open Son-kun opened 1 year ago

Son-kun commented 1 year ago

Hi, after connect CM4-fan-3007 to FAN pins (all 4) I can't force it to spin using I2C and cm4io-fan. Before instaling cm4io-fan when I run i2cdetect -y 10 I get correct value on 2f and I can change it (but fan dont spin). After install cm4io-fan i2cdetect return UU on 2f place, and when I try to set it manually i got Error Device or resource busy. In config.txt i have:

dtparam=i2c_arm=on
dtparam=i2c_vc=on
dtoverlay=i2c-fan,emc2301,i2c_csi_dsi
dtoverlay=cm4io-fan,minrpm=1000,maxrpm=3000

Other options are default, I'm trying to do it on clean rpi OS 64 Lite (september 22) with Compute Module 4 IO Board With PoE Feature.

Only when I disconnect last PIN then fan start working (regardless of the settings).

davidsafadinhooo commented 1 year ago

Hello @Son-kun, I am having exactly the same problem and also have the same version as you have.

Currently I am in the process of installing the version "2022-01-28-raspios-bullseye-arm64.zip" to test. I'll give you feedback in a moment.

davidsafadinhooo commented 1 year ago

@Son-kun with this version "2022-01-28-raspios-bullseye-arm64.zip" works ok!

sudo apt-get install -y i2c-tools sudo apt install raspberrypi-kernel-headers sudo apt install dkms wget https://github.com/neggles/cm4io-fan/archive/refs/tags/0.2.0.tar.gz sudo tar -xzvf 0.2.0.tar.gz -C /usr/src/ sudo dkms install cm4io-fan/0.2.0

ADD THIS LINES IN CONFIG.TXT

sudo nano /boot/config.txt

dtparam=i2c_arm=on dtparam=i2c_vc=on dtoverlay=cm4io-fan,minrpm=1000,maxrpm=3000

neggles commented 1 year ago
dtparam=i2c_arm=on
dtparam=i2c_vc=on
dtoverlay=i2c-fan,emc2301,i2c_csi_dsi
dtoverlay=cm4io-fan,minrpm=1000,maxrpm=3000

So you're trying to load both the i2c-fan overlay as well as my cm4io-fan overlay/driver at the same time. That's not going to work - they are not compatible, you can only have one thing controlling the fan at a time.

The i2c-fan overlay uses the mainline kernel driver that nVidia upstreamed recently, while my cm4io-fan package uses a different driver originally written by Mathew McBride at Traverse Technologies. Mathew also submitted his driver upstream, but he sent it later than nVidia sent theirs, so nVidia's made it in.

In my opinion, this driver is much nicer than nVidia's one. The nVidia driver only uses the EMC2301 in dumb PWM mode - it has no closed-loop RPM control, so instead of setting minrpm and maxrpm, you set minpwm and maxpwm.

You have two options:


Option 1: Use the Pi Foundation driver/overlay. You don't need this driver installed for that, all you need is to add these lines to /boot/config.txt:

dtparam=i2c_arm=on
dtparam=i2c_vc=on
dtoverlay=i2c-fan,emc2301,i2c_csi_dsi,minpwm=25,maxpwm=100,mintemp=50000,maxtemp=75000

Adjust the minpwm, maxpwm, mintemp, and maxtemp values to whatever you'd prefer. Make sure you do not have a line starting with dtoverlay=cm4io-fan!


Option 2: Use this overlay/driver, install as per instructions, then add this to /boot/config.txt:

dtparam=i2c_arm=on
dtparam=i2c_vc=on
dtoverlay=cm4io-fan,minrpm=1000,maxrpm=3000,mintemp=50000,maxtemp=75000

Adjust the minrpm, maxrpm, mintemp, and maxtemp values to whatever you'd prefer. Make sure you do not have a line starting with dtoverlay=i2c-fan!


Long story short, delete either the dtoverlay=i2c-fan line or the dtoverlay=cm4io-fan line from your /boot/config.txt; you can't use both at once, and they do different things.

Son-kun commented 1 year ago

@neggles I tried them independently and it didn't work. @davidsafadinhooo so if on old rpiOS it's working then why dont work on new one? I have before cm4io version 0.1.1, now after upgrade to 0.2.0 still didn't work. I don't want to downgrade OS version, so anyone have any idea what can create that issue?

davidsafadinhooo commented 1 year ago

Thanks @neggles for the quick response.

I performed a clean install with the latest version and just put in /boot/config.txt the following settings and it was working.

sudo nano /boot/config.txt

dtparam=i2c_arm=on dtparam=i2c_vc=on dtoverlay=i2c fan,emc2301,i2c_csi_dsi,minpwm=25,maxpwm=100,mintemp=50000,maxtemp=75000

@Son-kun I suggest you remove the cm4io-fan version you have and put only the settings mentioned in the boot/config.txt file.

neggles commented 1 year ago

Hmm. Good that i2c-fan works, at least, but no closed-loop RPM control is a bit of a bummer IMO. That feature is half the point of this chip! 😝

Ah, okay. I think I know what the problem is - upstream driver & this driver are using the same compatible = string in the devicetree overlay, so the kernel doesn't know which of the two drivers to load & it defaults to the built-in one rather than this external module.

If you'd rather have RPM control than PWM control, adding modprobe.blacklist=emc2305 to the end of /boot/cmdline.txt (and swapping out the config.txt overlay line) should prevent the upstream driver from loading & load this one instead (though udev might have other ideas).

I'd like to say I'll have time to get to this later today, but I doubt i'll be able to get to it until the weekend. If that workaround works, though, I can push a tiny little update to stop the names conflicting as a temporary fix.

Son-kun commented 1 year ago

It's still not working. Clean OS (september version), all 3 lines (dtparam & dtoverlay [i2c-fan]) added, cm4io-fan not installed. Fan not spinning, even if I set manualy i2cset -y 10 0x2f 0x30 0xff i got 0x00 on i2cget. modprobe added to end of cmdline.txt with switching on cm4io also not working. I even install old version of raspios (mentioned by @davidsafadinhooo ) and still nothing... Maybe it's fan fault? But still spinning on 3 pin... (on 12V and 5V).