I’m new to BBAI-64, I updated application and connected PWM FAN to FAN connector(J1).
FAN would spin during boot but after it would stop.
And in between HDMI display would flash and at that time FAN would rotate for short duration.
I’m new to linux and this is my first SBC, any help is appreciated.
Open /boot/firmware/extlinux/extlinux.conf you noitice a list of different boot optoins… Don’t modify the 1st option, that’s your backup if bootup fails… The last menu option (default)… add:
thanks for the response, I updated in extlinux.conf and I can see “BONE-FAN” in “proc/device-tree/chosen/overlays” but still FAN behavior is same. It only works when HDMI screen blink and board overheats
There is an issue with the overlay. It worked when I first wrote it, but has since stopped. It you check the kernel log you can see it fails the get the PWM as it is already in use.
I have not powered up my AI64 for many months, but I will try and have a.look at it this weekend.
The PWM is exported in the sys directory so you should be able to manually set it there. I believe the fact that it is exported is the reason the bone-fam overlay is.not.worling as it should.
thanks for the response, I tried " sudo systemctl disable --now bb-symlinks.service".
Still its same behavior. I tried “dmesg | grep pwm”,
Response:
pwm-fan: error -EBUSY: could not get PWM
pwm-fan: probe of pwm-fan failed with error -16.
I also tried “sudo modprobe pwm-fan”, still nothing.
Thanks for the response,.
I checked “lsmod | grep pwm”., response was
“pwm_fan 20480 0”.
I can see PWM in sys directory. I am unable to figure-out how to unexport the module.
Hope this information is useful.
ok, checking back through my original post, the issue is with initrd.img. This has a udev rule ( usr/lib/udev/rules.d/81-pwm-noroot.rules ) that automatically exports the PWM, thus preventing the fan from working.
The bb-symlink service I think is fine as it only creates sysmlinks in /dev/bone for exported devices.
of course the same rule also exists in the filesystem as well as initrd.img
Thanks you very much, I commented out contents of “81-pwm-noroot.rules” is both locations as per your answer in other thread. Now FAN starts immediately after boot
Thanks, Benedict! It’s working.
Quick memo how to configure 4-pin PWM fan on BBAI-64:
Edit init FS image /boot/firmware/initrd.img : comment out content of the /usr/lib/udev/rules.d/81-pwm-noroot.rules Note: initrd.img is a directory, archived by cpio and compressed by gzip
Do the same on root FS: comment out content of the /etc/udev/rules.d/81-pwm-noroot.rules
Edit /boot/firmware/extlinux/extlinux.conf : add /overlays/BONE-FAN.dtbo to fdtoverlays parameter in default section; adjust parameter initrd if you created new initrd image at step 1 with different name
Reboot. The fan should start rotating with appropriate speed after system is up.
Alternative way (instead of doing the steps above) - control fan speed manually:
cd /sys/class/pwm/pwmchip0/pwm1
echo 50000 > period
echo 10000 > duty_cycle
echo 1 > enable