AGX Thor add second fan on custom board

Hi NV,

I am using a custom AGX Thor board running JP7.2, and I would like to add a second fan to our custom board.

I ref
How to add fan2 configuration on /etc/nvfancontrol.conf? - Jetson Systems / Jetson Orin NX - NVIDIA Developer Forums and T5000新增PWM风扇如何配置 - Jetson Systems / Jetson Thor - NVIDIA Developer Forums to enable second fan.

I can see the second fan in the Jetson Power GUI and configure it to use open_loop mode for PWM speed control. However, when I increase the PWM value, the actual fan speed does not increase accordingly. It seems that the fan is still being controlled based on RPM.

How can I configure the system so that the second fan can also be controlled through PWM?

Below are the modifications I made:
tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0008.dtsi.txt (92.2 KB)
tegra264-mb1-bct-gpio-p3834-xxxx-p4071-0008.dtsi.txt (3.4 KB)

  1. Edit pwm5 and tachometer@810c5d0000 status from “disabled” to “okay” in tegra264.dtsi
pwm5: pwm@810c600000 {
			compatible = "nvidia,tegra264-pwm";
			status = "okay";

			reg = <0x81 0x0c600000 0x0 0x10000>;
			nvidia,hw-instance-id = <0x5>;
			clocks = <&bpmp TEGRA264_CLK_PWM5>;
			clock-names = "pwm";
			#pwm-cells = <2>;
			resets = <&bpmp TEGRA264_RESET_PWM5>;
			reset-names = "pwm";
		};

tachometer@810c5d0000 {
			compatible = "nvidia,pwm-tegra264-tachometer";
			status = "okay";
			reg = <0x81 0x0c5d0000 0x0 0x10>;
			#pwm-cells = <2>;
			clocks = <&bpmp TEGRA264_CLK_CLK1M>;
			resets = <&bpmp TEGRA264_RESET_TACH1>;
			clock-names = "tach";
			reset-names = "tach";
			pulse-per-rev = <2>;
			capture-window-length = <2>;
			disable-clk-gate;
        };

  1. Add new pwm-fan2 in tegra264-p4071-0000.dtsi like soc_fan: pwm-fan
second_fan: pwm-fan2 {
		compatible = "pwm-fan";
		pwms = <&pwm5 0 40000>;
		cooling-levels	= <77 102 140 192 255>;
		#cooling-cells = <2>;
	};

Flash image to custom AGX Thor board running JP7.2 and

  1. Check pwm-fan2 and tachometer@810c5d0000
$ ls /sys/devices/platform/ | grep pwm-fan
pwm-fan
pwm-fan2

$ ls /sys/devices/platform/bus@0/ | grep tachometer
810c5c0000.tachometer
810c5d0000.tachometer
  1. Add fan2 under /etc/nvpower/libjetsonpower/jetsonpower_t264.conf
$ sudo nano /etc/nvpower/libjetsonpower/jetsonpower_t264.conf
# p4071-all
p4071,all,FAN,fan1,FAN_PWM,/sys/devices/platform/pwm-fan
p4071,all,FAN,fan1,RPM_MEASURED,/sys/devices/platform/bus@0/810c5c0000.tachometer
p4071,all,FAN,fan1,TACH_ENABLE,null
p4071,all,FAN,fan2,FAN_PWM,/sys/devices/platform/pwm-fan2
p4071,all,FAN,fan2,RPM_MEASURED,/sys/devices/platform/bus@0/810c5d0000.tachometer
p4071,all,FAN,fan2,TACH_ENABLE,null
p4071,all,INA,ina238,BUS,2-0044
  1. Add fan2 under /etc/nvfancontrol.conf
<FAN 2>
        TMARGIN ENABLED
        FAN_GOVERNOR pid {
                STEP_SIZE 10
        }
        FAN_GOVERNOR cont {
                STEP_SIZE 10
        }
        FAN_CONTROL close_loop {
                RPM_TOLERANCE 100
        }
        FAN_PROFILE cool {
                #TEMP   HYST    PWM     RPM
                0       0       255     5371
                15      0       255     5371
                24      0       192     4170
                29      0       140     2900
                35      0       102     2300
                45      0       77      1750
                115     0       77      1750
        }
        THERMAL_GROUP 0 {
                GROUP_MAX_TEMP 115
                #Thermal-Zone Coeffs Max-Temp
                cpu-thermal 25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
                gpu-thermal 25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
                soc012-thermal 25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
                soc345-thermal 25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
        }
        FAN_DEFAULT_CONTROL open_loop
        FAN_DEFAULT_PROFILE cool
        FAN_DEFAULT_GOVERNOR cont
        KICKSTART_PWM 51
  1. Restart the nvfancontrol service
sudo systemctl stop nvfancontrol
sudo rm /var/lib/nvfancontrol/status
sudo systemctl start nvfancontrol

Thanks!!

hello SamM11,

just for confirmation, are you able to change 2nd fan speed by setting PWM values manually?
for instance, please toggle PWM without nvfancontrol service for testing.
$ sudo systemctl stop nvfancontrol
$ sudo systemctl disable nvfancontrol
$ echo user_space | sudo tee /sys/class/thermal/thermal_zone*/policy
$ sudo -i
# echo 215 > /sys/class/hwmon/hwmon0/pwm1 <== revise this to maps to your 2nd fan

Hi @JerryChang ,

Yes, I can change 2nd fan speed by setting PWM values manually.

#soc fan
/sys/devices/platform/pwm-fan/hwmon/hwmon1$ ls
device  name  of_node  power  pwm1  pwm1_enable  subsystem  uevent
#second fan
/sys/devices/platform/pwm-fan2/hwmon/hwmon2$ ls
device  name  of_node  power  pwm1  pwm1_enable  subsystem  uevent

$ sudo systemctl stop nvfancontrol
$ sudo systemctl disable nvfancontrol
$ echo user_space | sudo tee /sys/class/thermal/thermal_zone*/policy
$ sudo -i
# echo 215 > /sys/class/hwmon/hwmon2/pwm1

cat /sys/class/hwmon/hwmon2/pwm1
215

cause pwm1?

Thanks!!

hello SamM11,

please update tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0008.dtsi.txt as below.

			soc_gpio127_pl3 {
				nvidia,pins = "soc_gpio127_pl3";
				nvidia,function = "nv_therm_fan_tach1";
-				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;

and.. please examine the pwm/rpm via sysnode for confirmation.

Hi @JerryChang ,

below are my schematic.

cat /sys/class/hwmon/hwmon2/pwm1
215

cat /sys/class/hwmon/hwmon6/rpm
529

Thanks!!

I assume these two are correct hw monitor node, hwmon2 and hwmon6.
since configure pwm to 215 changes the physical fan speed, the problem is likely soc_gpio127_pl3 is not receiving a clean tach waveform.
please probe the signal if that’s possible, the pin should rises to approximately 1.8V, its frequency should rise with fan speed.

Hi @JerryChang ,

After measuring the signal, we confirmed that it does reach approximately 1.8 V.

We also measured the signal at R1242, and there is no signal coming from the SoC side either.

Could there be any software configuration that I have not modified yet?

Thanks!!

hello SamM11,

may I double check your target board configuration for image flashing.
for instance,
you’ve modified tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0008.dtsi.
Jetson AGX Thor NVMe configuration normally uses the p4071-0000 pinmux instead.
for instance, jetson-agx-thor-devkit.conf -> p3834-0008-p4071-0000-nvme.conf

you may have commands below to dump device tree into dts formats.
$ sudo dtc -I fs -O dts /sys/firmware/devicetree/base > /tmp/123.dts
please examine you’ve below definitions.

  soc_gpio127_pl3 {
          nvidia,pins = "soc_gpio127_pl3";
          nvidia,function = "nv_therm_fan_tach1";
          nvidia,pull = <TEGRA_PIN_PULL_UP>;
          nvidia,tristate = <TEGRA_PIN_ENABLE>;
          nvidia,enable-input = <TEGRA_PIN_ENABLE>;
  };

  soc_gpio177_pu7 {
          nvidia,pins = "soc_gpio177_pu7";
          nvidia,function = "gp_pwm5"; 
          nvidia,pull = <TEGRA_PIN_PULL_NONE>;
          nvidia,tristate = <TEGRA_PIN_DISABLE>;
          nvidia,enable-input = <TEGRA_PIN_DISABLE>;
  };

Hi @JerryChang ,

Thanks for reply,

I modified the PWM and TACH sections in tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000.dtsi, just as I did in tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0008.dtsi, and it worked successfully.

Thank you very much for your help.

However, I am curious why some configurations can take effect by modifying only tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0008.dtsi, while others, such as the PWM configuration in this case, also require changes to tegra264-mb1-bct-pinmux-p3834-xxxx-p4071-0000.dtsi in order to take effect.

Thanks!!

thanks for confirmation, glad to know it works.

that may due to P4071-0008 Linux device tree inherits the P4071-0000 Linux device tree.
but, that inheritance applies only to the Linux kernel DT. it does not apply to the MB1 pinmux BCT.

as you can see,
it’s jetson-agx-thor-devkit.conf selects p4071-0000 pinmux for the flash configuration.
you should have the changes to be in the same MB1 pinmux as well.

Hi @JerryChang ,

Thanks for reply,

Thank you for clarifying my question. I will move all of my pinmux modifications to the correct configuration.
image

I also encountered another issue. When the system boots, the second fan I added suddenly runs at full speed (PWM: 255). The original SoC fan also temporarily runs at full speed, similar to the behavior described in this post. JP7.2 R3920 开机的时候有概率 到内核阶段风扇声音特别大 - Jetson Systems / Jetson Thor - NVIDIA Developer Forums

After a short period of time, the SoC fan returns to the PWM value configured in nvfancontrol (PWM: 77). However, the second fan I added does not return to its configured value and remains fixed at PWM: 255.

I have to manually adjust the PWM value to bring the second fan back to the expected speed.

Could you please advise why this happens and how I can make the second fan behave the same way as the original SoC fan during boot?

Thanks!!

The fan cooling maps are in:

Linux_for_Tegra/source/hardware/nvidia/t264/nv-public/nv-platform/tegra264-p4071-0000+p3834-0008-nv.dts

Nvidia names the fan soc_fan.

If second_fan is already defined as a pwm-fan with #cooling-cells = <2>, you could add it to the existing tj-thermal cooling maps.

cooling-maps {
        map-active-0 {
                cooling-device = <&soc_fan 0 1>,
                                 <&second_fan 0 1>;
                trip = <&tj_trip_active0>;
        };

        map-active-1 {
                cooling-device = <&soc_fan 1 2>,
                                 <&second_fan 1 2>;
                trip = <&tj_trip_active1>;
        };

        map-active-2 {
                cooling-device = <&soc_fan 2 3>,
                                 <&second_fan 2 3>;
                trip = <&tj_trip_active2>;
        };

        map-active-3 {
                cooling-device = <&soc_fan 3 4>,
                                 <&second_fan 3 4>;
                trip = <&tj_trip_active3>;
        };
};

That should put second_fan under the same kernel thermal policy as soc_fan, and that looks to be what’s missing.

Hi @whitesscott ,

Thanks for reply,

Following your suggestion, I can now confirm that the second fan follows the SoC fan and returns to the PWM value configured in nvfancontrol during boot.

Thanks!!