[BBAI-64] PWM FAN is not working after boot

Hello all,

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.

Thanks in advance.
Tejo

the fan is pwm controlled, you need to load a specific overlay to enable pwm… src/arm64/overlays/BONE-FAN.dts · v5.10.x-ti-unified · BeagleBoard.org / BeagleBoard-DeviceTrees · GitLab

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:

fdtoverlays /overlays/BONE-FAN.dtbo

Regards,

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.

So the pwm export script is located here:

/usr/sbin/bb-symlinks

This will stop it:

 sudo systemctl disable --now bb-symlinks.service

Thinking this will mask it… bb-customizations (1.20231201.0) (b490a34b) · Commits · BeagleBoard.org / repos-arm64 · GitLab

Regards,

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

2 Likes

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

2 Likes

Hi Tejo, i found only one instance of the file (/etc/udev/rules.d/81-pwm-noroot.rules). Where is the second location? Can you share details please.

Regards,
Maksym

The other instance is I think in /boot someplace. Look for a file named initt something.

It is a bit of a pain to change, but if you Google edit initramfs you should find some instructions.

You have to extract the image, remove the file and then convert back to an image file

1 Like

Thanks, Benedict! It’s working.
Quick memo how to configure 4-pin PWM fan on BBAI-64:

  1. 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
  2. Do the same on root FS: comment out content of the /etc/udev/rules.d/81-pwm-noroot.rules
  3. 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
  4. 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

3 Likes