spaxton Posted Monday at 03:20 PM Posted Monday at 03:20 PM Hello, Recently I tried to make pwm control on my Nanopi M4. Beside the PWM pin on the 24 pin connector (the one which actually controls the voltage output on 12V 2 pin connector for fan), I wonder if it is possible to use GPIO pins on the 40 pin connector as pwm pins to control fans. I tried to set pwmchip0 and literally checked every pin by connecting the wire to each one of them but I couldn't find that any othe these GPIO react on any settings I made on pwmchip0 pwm0. Does anyone know how to do this? Best Regards. 0 Quote
spaxton Posted Monday at 05:07 PM Author Posted Monday at 05:07 PM If using the rest of GPIO as PWM is not possible, can I somehow make the fan run dynamically according to the hard drives temperature and not according to the CPU temperature? 0 Quote
Igor Posted Monday at 07:02 PM Posted Monday at 07:02 PM 1 hour ago, spaxton said: can I somehow make the fan run dynamically according to the hard drives temperature and not according to the CPU temperature? Try to rework the script: https://github.com/armbian/build/blob/main/packages/bsp/nanopim4/nanopim4-pwm-fan.sh#L316 Perhaps expand it to support selecting CPU / hard drive ? 1 Quote
spaxton Posted Monday at 09:06 PM Author Posted Monday at 09:06 PM Hello Igor, Thanks for fast reply. I tried something manually then I tried some scripts and now I tried Your script. It seems that I have to solve some other problem first since none of the scripts are working as they should (the results are strange). Setup is like this: 1. OS is openmediavault debian based linux. 2. NanoPI M4 with sata hat 3. 4 wire thermalright fan where the pwm wire is connected to pin 23 of the 24 pin connector (I don't want to use 2 pin fan connected to sata hat) The fan behaviour now is like this: 1. Fan rotates at the lowest speed as soon as the system boots up. During boot, fan is rotating at its max RPM. 2. Setting the parameters manually does not affect the fan speed. Parameters of the pwmchip1 pwm0 like duty_cycle and timing 3. running the script after the system is running for a while does not rotate the fan at maximum (if I undertsand well, it should) 4. running the script right after the boot, slightly for a short time changes the RPM of the fan (not for the specified time in script) So, even with CPU measurements, it doesn't work in my setup. Since You are the author of this script, do You have any idea why does this behave this way? Best regards. Vuk. 0 Quote
Igor Posted Tuesday at 06:47 AM Posted Tuesday at 06:47 AM 9 hours ago, spaxton said: I tried something manually then I tried some scripts and now I tried Your script. This is the script we ship by default with this hardware. And IIRC it use to work as expected: - spin up at boot is by a purpose, like a check that dan is in operation - when temp goes up, it should spin up It is possible that something isn't working right anymore. Perhaps try to ping author: https://github.com/armbian/build/blob/main/packages/bsp/nanopim4/nanopim4-pwm-fan.sh#L6-L7 0 Quote
spaxton Posted Tuesday at 07:34 PM Author Posted Tuesday at 07:34 PM Ok, Igor. Thanks for help. I'll try to ask the author. Best regards. 0 Quote
spaxton Posted Tuesday at 09:34 PM Author Posted Tuesday at 09:34 PM (edited) Hello Igor. I have found the problem. The period is wrong in this script since it needs to be in nanosecods. 25000000 nanoseconds does not equal 25kHz. Instead of it, it is needed to put 20000 ns. After changing this, the fan reacts when the script runs the reset. build/packages/bsp/nanopim4/nanopim4-pwm-fan.sh at main · armbian/build · GitHub ***update*** It seems like the script uses period value to calculate the duty cycle and calculates 50% as half of the period which is actually 25%. If I understand it well, these two values are different things. So, if the period is 20000 ns which corresponds to 25kHz then duty cycle 20000 should be 50% while duty cycle 40000 is 100%. Currently, the script keeps the duty cycle to 5000 which is 12.5%. The fan runs faster than before I changed the value of period but it still does not spin up enough. Unfortunately, I don't have enough knowledge to correct the script this way. Best regards. Edited Tuesday at 10:01 PM by spaxton 0 Quote
Werner Posted 20 hours ago Posted 20 hours ago Did you reach out to the author? https://github.com/cgomesu/nanopim4-satahat-fan It seems there were a few adjustments since we implemented it: https://github.com/cgomesu/nanopim4-satahat-fan/commits/master/pwm-fan.sh 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.