Rem0o / FanControl.Releases

This is the release repository for Fan Control, a highly customizable fan controlling software for Windows.
Other
14.47k stars 453 forks source link

V141 Unable to control specific fan #1408

Closed djinnerator closed 1 year ago

djinnerator commented 1 year ago

Describe the bug FanControl controls all my fans, even GPU fans, except one specific fan, which is Chassis Fan 1. My board is ASRock B650M Riptide. When I set a flat curve of either 0% or 100%, the speed continues as if I never even changed anything. At 0% or 100%, the RPM is around 400-700, depending on MB temp (set in BIOS). I can control the fan in BIOS, when using ASRock Phantom Gaming, and Argus Monitor has no issues controlling that fan, or all fans really. I've tried with three different fans, two 4-pin and one 3-pin. I've set my BIOS to either PWM or DC mode specifically for each fan, so it's not on Auto. Even tried with Auto, same results.

When I try find fan start/stop % automatically, I get the message "Fan never stopped."

Right now, with BIOS controlling my fans, FanControl shows this one fan at 0% yet with ~420 RPM. If I enable the fan control and set it to a any curve, it shows what the fan percent should be, but RPM never changes outside of the already fluctuations.

Is there a log.txt file next to FanControl.exe with recent date entries? Recent, yes, but the only entries are two, which are from the program being unable to contact raw.githubusercontent.com. Highly doubtful that's the cause.

Relevant hardware specs and setup W11 ASRock B650M Riptide Noctua NF-A12 PWM (fwiw) Some random Corsair (fwiw)

An example of how the controller looks when disabled. An example of how the controller looks when disabled.

100% flat curve 100% flat curve

0% flat curve 0% flat curve

djinnerator commented 1 year ago

I just attempted this with V140 and everything works fine. I can stop the fan and bring it to 100%. So the problem must've been introduced with V141 maybe?

0% fan curve image

100% fan curve image

Rem0o commented 1 year ago

If you take the LibreHardwareMonitorLib.dll from V140 and drop it into FanControl V141 and replace it, what behavior do you get?

djinnerator commented 1 year ago

If you take the LibreHardwareMonitorLib.dll from V140 and drop it into FanControl V141 and replace it, what behavior do you get?

When I use 4.8: Same outcome. Can't control that one fan. When I use 7.0: I get initialization errors and all the motherboard fans and sensors are gone. I can only see my graphics card fans, which I can control, but the fan percent and RPM never change.

image

image

image

The log is empty when I try with 4.8 With 7.0 it shows this:

12/27/2022 9:27:21 PM: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at FanControl.Domain.BackendProviders.LHM.LHMBackendProvider.Open()
   at FanControl.Domain.ComputerAccessLayer.Initialize()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

12/27/2022 9:27:21 PM: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at FanControl.Domain.BackendProviders.LHM.LHMBackendProvider.Close()
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at FanControl.Domain.ComputerAccessLayer.Close()
   at FanControl.Domain.ComputerAccessLayer.<>c__DisplayClass11_0.<<TryRefresh>b__0>d.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

12/27/2022 9:27:21 PM: Initialization failed.

But both version of V140 work when I use them as is.

Rem0o commented 1 year ago

You can’t mix and match 4.8 and 7.0 net versions. Stick with 4.8 for 140 and 141 tests.

djinnerator commented 1 year ago

Not sure if it matters, but the issue is also in V142 too.

djinnerator commented 1 year ago

@Rem0o Is there anything else I can do to help solve this? I'm willing to try anything. Was the issue abandoned?

I don't want to seem like I'm hovering (don't like bumping these, makes me feel pushy), I know you're busy and this is all free as a side project. I'm happy with the software as is, even while not able to control that fan, I can control everything else, I just don't want to be forgotten :D When I've checked other issues, I couldn't find anyone else with this problem or similar so I understand this could be low priority.

I appreciate all you're doing :)

djinnerator commented 1 year ago

I downloaded the latest release version of LHM and it doesn't detect any sensors on my motherboard. I downloaded the latest nightly and it shows every sensor and I can control every fan, including the one I've been having issues with from FanControl.

So there's that...

Rem0o commented 1 year ago

Take the lib dll from the nightly, and replace the FanControl one with it then?

djinnerator commented 1 year ago

Take the lib dll from the nightly, and replace the FanControl one with it then?

Still doesn't work. I'm pretty sure the nightly is based on .net 4.7, not 4.8. The only download for the nightly ends in "net472"

Rem0o commented 1 year ago

FYI, for each version of FanControl, I compile LHM myself without any modification, at the latest commit.

djinnerator commented 1 year ago

Ok, I could give that a shot.

djinnerator commented 1 year ago

I compiled LHM from source, and dropped the .dll into the FanControl directory. Still can't control that one fan with FanControl, but I can control it with the LHM I compiled...sigh...

Rem0o commented 1 year ago

^ In your test, do you use the assisted setup or you just test manually? I would test manually to avoid any uneeded variable. If LHM can control your fan, the fan control equivalent of enabling a control, setting manual mode is the exact same function call.

djinnerator commented 1 year ago

I've only ever done manual. Idk what else to do. Is FanControl open source? If so, maybe I could just follow the LHM instructions on including it with FanControl and just try to have my own local version that could work.

I've compiled it for .net 4.8 and it works perfectly fine with LHM but FanControl just refuses to work with that one fan header even with the compiled LHMLib dll :(

Based on what I've seen with LHM it makes sense that FanControl is just calling that same function, but I'm lost. Maybe I'll just have to set a fan curve in BIOS and just adjust it from there as needed.

Rem0o commented 1 year ago

The fact it "works" in LHM and not in FanControl is a red flag to me. It's litterally the exact same thing. Hell, you could even attach the debugger to FanControl.exe and breakpoint into the LHM source code.

To be sure, what exactly do you look for in LHM specifically and from FanControl as your assertion that it "works" or not ?

djinnerator commented 1 year ago

The fact it "works" in LHM and not in FanControl is a red flag to me. It's litterally the exact same thing.

That's what I thought but there's clearly a disconnect somewhere.

what exactly do you look for in LHM specifically and from FanControl as your assertion that it "works" or not ?

LHM shows all the current and max fan speeds of my motherboard and GPU. It also shows the controls and the duty cycle of all my controls. Fan control shows the exact same thing. The difference is, in LHM, when I right click the control for Fan Control 4 (which is the one that FanControl isn't controlling), and set the duty cycle manually to 100% or to any number, the fan speed changes accordingly. If I do the same thing with FanControl, nothing changes for that fan header.

It's really not convoluted to do this, it's really simple and straightforward. It's the only fan where the motherboard curve is keeping it around 430RPM so I can easily find it amongst my fans because it's the only one at that speed and when I adjust it with LHM, I see and hear it change. It does not change with FanControl. The duty cycle claims to be changing but RPM doesn't.

Idk how else to describe the issue...

djinnerator commented 1 year ago

Do you want me to record my screen adjusting LHM showing the fan changing? And FanControl not affecting that fan? Would you believe me then?

Rem0o commented 1 year ago

The difference is, in LHM, when I right click the control for Fan Control 4 (which is the one that FanControl isn't controlling), and set the duty cycle manually to 100% or to any number, the fan speed changes accordingly. If I do the same thing with FanControl, nothing changes for that fan header.

Do you use the exact same DLL ( LibreHardwareMonitorLib.dll ) on both FanControl.exe and LibreHardwareMonitor.exe for that specific test?

If you do the opposite test, take V144 LibreHardwareMonitorLib.dll and put it into LibreHardwareMonitor, can you control the System Fan 4?

djinnerator commented 1 year ago

Do you use the exact same DLL ( LibreHardwareMonitorLib.dll ) on both FanControl.exe and LibreHardwareMonitor.exe for that specific test?

Yes. It works for LHM, but not FanControl.

If you do the opposite test, take V144 LibreHardwareMonitorLib.dll and put it into LibreHardwareMonitor, can you control the System Fan 4?

Yes, it still works with LHM. Only FanControl doesn't control Fan 4.

Rem0o commented 1 year ago

Can you send your config json file? Otherwise, I really don't have a clue.

djinnerator commented 1 year ago

Can you send your config json file? Otherwise, I really don't have a clue.

GitHub doesn't support uploading .json so I zipped it. It's nicknamed "Chassis Fan1" which is Fan #3 in the .json, which corresponds to Fan Control 4 in LHM. Sensors.zip

djinnerator commented 1 year ago

I've tried with a new config file, and also a clean download of FanControl and same result.

Rem0o commented 1 year ago

Just went through your config, and the fan matching between control and speed for "Chassis Fan1", which is "Fan #4", seems weird. image

I would expect indexes between controls and speeds to be the same, like these: image image image

djinnerator commented 1 year ago

What would be Fan Sensor 2 doesn't exist on my board. Even in LHM, it shows as 0RPM, 0% power. That specifically is Fan 3 on Control 4.

I manually edited the .json file to have them match and FanControl doesn't read the speed of that fan anymore. Probably because that control doesn't exist.

I can use that exact same .json V140 and it works, but anything after that version and it doesn't work with that control.

Rem0o commented 1 year ago

Im out of ideas.

If you are handy with VS, you can try and debug this file: https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/blob/master/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Nct677X.cs

More specifically this method:

public void SetControl(int index, byte? value)

You can attach the Visual Studio debugger to FanControl.exe, make sure the dll and pdb are both in fancontrol's folder.

djinnerator commented 1 year ago

Ok I'll give it a shot when I get back home later. Hope for the best ¯\_(ツ)_/¯

djinnerator commented 1 year ago

I'm confused. I used VS to attach to FanControl and LHM. They both use the same value for index (3), _port (656), ADDRESS_REGISTER_OFFSET (5), BANK_SELECT_REGISTER (78), DATA_REGISTER_OFFSET (6), and value (0) the first time the function WriteByte is called, which sets manual mode. The second time, all of those variables are the same except for value which is a percentage out of 255 which sets the duty cycle (%) of the fan. For example, value.Value = 63 when the duty cycle is 25%. 12 when the duty cycle is 5%, etc. It works when LHM does it, but not when FanControl does it.

The only difference is that with LHM, it sets the duty cycle immediately. FanControl tries to change that value in increments. Even if I change the Step Up/Down values to 50%/sec, it doesn't actually do that. So if I set that fan to 100%, LHM sets the output value for value.Value to 255. FanControl is supposed to, according to the Step Up value, set value.Value to 127 and then change that value again to 255. It doesn't do that. I saw 92, then 97, and so on. While doing that, the fan's speed would never change.

But FanControl shows the percentage because Control.cs has a function that sets the text value with:

_settings.SetValue(new Identifier(Identifier, "value").ToString(), value.ToString(CultureInfo.InvariantCulture));

That at least explains why FanControl shows what the duty cycle should be, but I don't understand why the control isn't changing the duty cycle...

My only suggestion to see maybe if it would work, is to add an option to Step Up/Down to immediately change duty cycle instead of capping the max to 50%/sec.

image

The highest those two values can be right now is 50%/sec. I think if that can be changed to 100%/sec (or immediately) maybe that could fix the issue. I don't see why that would solve it because I'd expect it to be able to adjust to the smaller changes, it doesn't even adjust to the 50% duty cycle change, but maybe it's worth a shot?

Rem0o commented 1 year ago

^ You could edit the json file manually, but that setting won't change anything relevant to our matter.

You got to the heart of it and somehow the same low end function call does not end with the same result. In your tests, did you have only 1 control enabled? If you saw some 94-97, that tells me it was probably not your Chassis Fan 1 since you got 50% steps.

djinnerator commented 1 year ago

There were no other controls enabled, just that one, except when trying to see if the other values change like _port. Even with just that control enabled, the fan won't change from 400-500RPM and the Step Up value was low even when set to 50%/sec.

Rem0o commented 1 year ago

Btw, the % shown in FanControl is actually a readback value from the chip, as you can see here:

image

FanControl just takes that 0-255 value and transforms it into a % for display purposes. Meaning, it isn't what it "should" be, but what's actually written in the control register. Now what the controller decides to do with that value in the register, that's an other story, and maybe at the source of the issue.

Also, in your tests, remove any paired RPM sensor to your controls. There is some built-in logic linked to that fan rpm, which if something is wrong, might complicate the diagnosis/debugging. Just to keep complexity out of the way.

One last thing, that control that you've hidden, image

What does that controls? Try and unhide it and put it on. Because to me it would be obvious that this the one that should control your fan, but you got it your rpm sensor paired up with control index 2 instead, the one you are testing on right now which is not working. image

djinnerator commented 1 year ago

I just tried with a fresh download of FanControl, so no controls and sensors are paired in this test. I then matched that fan, which still shows as control 2, with fan 3 ¯\_(ツ)_/¯. I know I'm not supposed to have multiple fan control programs running at the same time, but just to verify, I had LHM up and set that control to 100% and it works as expected, also showing in FanControl with the increased duty cycle. I then saved that config, closed both processes, then reopened FanControl. Same issue.

The problem doesn't exist with V140 so I guess I'll just use that from now on. I don't think any of the updates since then has any effect on my board, so aside from the control issue, V140 and V143 are no different for me.

Thanks for trying to help solve the issue! :D