Welcome! Log In Create A New Profile

Advanced

NSA325 fan control

Posted by Koen 
NSA325 fan control
October 07, 2019 02:51PM
Hi,

I've got a NSA325 and it is currently running OpenWrt with the option to boot Debian from an USB stick. Both OpenWrt and Debian do not seem to have the ability to adjust the fan speed on the NSA325 at the moment. Based on the findings by 030theo in the NSA326 thread I decided to inspect the stock firmware to see if I could find something.

Running binwalk on the stock firmware does show the following script:

ext-root/etc/init.d/conf_ADT7463A.sh

ADT7463 is a Remote Thermal Controller and Voltage Monitor as can be seen in the following document.

https://www.onsemi.com/products/sensors/thermal-management/fan-controllers/adt7463

This is the script:

#!/bin/sh
        #
        # Automatic Fan Controlling of ZW1050 (by CCWu 2005-05-06)
        #

        # PWMx at Min Duty Cycle while temp < T_min
        #/sbin/i2cset -y 0x0 0x2e 0x62 0xa0 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x63 0x00 b 1>/dev/null 2>/dev/null

        # PWM_min = 25%, if temp is below T_min, fan will operate with 25% duty cycle
        #/sbin/i2cset -y 0x0 0x2e 0x64 0x40 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x65 0x40 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x66 0x40 b 1>/dev/null 2>/dev/null

        # T_min = 25
        #/sbin/i2cset -y 0x0 0x2e 0x67 0x19 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x68 0x19 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x69 0x19 b 1>/dev/null 2>/dev/null

        # THERM Limit = 55 degree C, if exceeded this, fan will operate with 100% duty cycle, full speed
        #/sbin/i2cset -y 0x0 0x2e 0x6A 0x37 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x6B 0x37 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x6C 0x37 b 1>/dev/null 2>/dev/null

        # Fastest Speed calculated by all three temperature channels controls PWMx
        # (Automatic Fan Control Mode)
        # work-around: disable fan control to avoid abnormal fan speed
        #/sbin/i2cset -y 0x0 0x2e 0x5C 0xC2 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x5D 0xC2 b 1>/dev/null 2>/dev/null
        #/sbin/i2cset -y 0x0 0x2e 0x5E 0xC2 b 1>/dev/null 2>/dev/null
        
        # (Manual Fan Control Mode)
        /sbin/i2cset -y 0x0 0x2e 0x5C 0xe2 b 1>/dev/null 2>/dev/null
        /sbin/i2cset -y 0x0 0x2e 0x5D 0xe2 b 1>/dev/null 2>/dev/null
        /sbin/i2cset -y 0x0 0x2e 0x5E 0xe2 b 1>/dev/null 2>/dev/null
        # Set PWMx current duty cycle
        /sbin/i2cset -y 0x0 0x2e 0x30 0x50 b 1>/dev/null 2>/dev/null
        /sbin/i2cset -y 0x0 0x2e 0x31 0x50 b 1>/dev/null 2>/dev/null
        /sbin/i2cset -y 0x0 0x2e 0x32 0x50 b 1>/dev/null 2>/dev/null

        ####################
        # Emma-2006.12.1  
        # Initialization of HW monitor interrupt

        # set ADT7463 pin 10 as /SMBALERT
        /sbin/i2cset -y 0x0 0x2e 0x78 0x1 b 1>/dev/null 2>/dev/null

        # set fan1 minimum to 0
        #i2cset -y 0x0 0x2e 0x54 0x0 b
        #i2cset -y 0x0 0x2e 0x55 0x0 b
        i2cset -y 0x0 0x2e 0x54 0xff b 1>/dev/null 2>/dev/null
        i2cset -y 0x0 0x2e 0x55 0xff b 1>/dev/null 2>/dev/null

        # set thermal interrupt limits, 0xb5=-75 degreeC, 0x4b=75 degreeC
        # (refer to ADT7463 dastasheet p.17)
        i2cset -y 0x0 0x2e 0x4e 0xb5 b 1>/dev/null 2>/dev/null
        i2cset -y 0x0 0x2e 0x4f 0x4b b 1>/dev/null 2>/dev/null
        i2cset -y 0x0 0x2e 0x50 0xb5 b 1>/dev/null 2>/dev/null
        i2cset -y 0x0 0x2e 0x51 0x4b b 1>/dev/null 2>/dev/null
        i2cset -y 0x0 0x2e 0x52 0xb5 b 1>/dev/null 2>/dev/null
        i2cset -y 0x0 0x2e 0x53 0x4b b 1>/dev/null 2>/dev/null

        # enable interrupts: Remote 1 temperature channel, local temperature channel, Remote 2 temperature channel, and fan1.
        i2cset -y 0x0 0x2e 0x74 0x0f b 1>/dev/null 2>/dev/null
        i2cset -y 0x0 0x2e 0x75 0xfb b 1>/dev/null 2>/dev/null

        # End of Initialization of HW monitor interrupt
        ###################

        ###################################################
        # Make sure fan speed will be greater than 2000 rpm
        #fanrpm=`cat /sys/devices/platform/i2c-0/0-002e/fan1_input`
        fanrpm=`cat /sys/bus/i2c/devices/0-002e/fan1_input`
        var=`i2cget -y 0x0 0x2e 0x30`

        while [ $fanrpm -lt 2000 ]; do
                var=$((var+0x8))
                if [ $var -gt 112 ]; then
                        break;
                fi 

                echo "fanspeed $fanrpm , pwm value $var"

                /sbin/i2cset -y 0x0 0x2e 0x30 $var b 1>/dev/null 2>/dev/null
                /sbin/i2cset -y 0x0 0x2e 0x31 $var b 1>/dev/null 2>/dev/null
                /sbin/i2cset -y 0x0 0x2e 0x32 $var b 1>/dev/null 2>/dev/null         
                sleep 1
                #fanrpm=`cat /sys/devices/platform/i2c-0/0-002e/fan1_input`
                fanrpm=`cat /sys/bus/i2c/devices/0-002e/fan1_input`
        done
        # End of fan speed adjustment
        ##################

        ###################################################
        # Start PID Fan  control
        if [ -x /sbin/fanctrld ]; then
                /bin/echo "Starting PID Fan Control.."
                /bin/nice -n 15 /sbin/fanctrld 0x0 0x2e
        fi

The ADT7463 chip seems to be supported by the hwmon lm85 kernel driver.

https://www.kernel.org/doc/Documentation/hwmon/lm85

However installing this driver in OpenWrt does not make the fan / sensor show up in lm-sensors. I guess the sensor / fan needs to be defined in the dts / dtb file first. I hope anybody on here has an idea how to get fancontrol working? I'm happy to use my NAS to experiment / run tests to get this working

Thanks,

Koen
Re: NSA325 fan control
October 07, 2019 02:56PM
The end of the script above calls the binary /sbin/fanctrld. I guess it is not possible to just copy this over since it is compiled for a much older system?

When I run 'strings fanctrl' this is the output:

strings fanctrld 

/lib/ld-linux.so.3
__gmon_start__
libc.so.6
exit
readdir
sprintf
fopen
strncmp
closedir
fork
abort
strtol
fgets
strlen
__errno_location
chdir
memcpy
fclose
strtoul
umask
strcasecmp
raise
opendir
sscanf
stderr
ioctl
index
fwrite
fprintf
sleep
setsid
getrlimit
strerror
__libc_start_main
GLIBC_2.4
!1C "
Error: Could not set address to %d: %s
Error: Could not get the adapter functionality matrix: %s
Error: Adapter for i2c bus %d does not have read word data capability
Syntax: pidcontrold [-option] I2CBUS CHIP-ADDRESS [LowestPWM] [Tolerance]
  option will set P,I,D constant value by
     P d: assign d(decimal) value to P constant
     I d: assign d(decimal) value to I constant
     D d: assign d(decimal) value to D constant
     Tn c: Set setpoint of sensor Tn value c
     Wn d: Set Weight for each sensors
     S d: Set sampling rate to d seconds
     M d: Set multiple value for the error
     X d: Set the Maximum pwm value
     LowestPWM set the minimum pwm value
     Tolerance set the tolerance value, shoule be scale with %d
  I2CBUS is an integer
Warning: unsupported sensor number T%d
Warning: unsupported weight sensor number W%d
Warning: Unsupported flag "-%c"!
Error: I2CBUS argument invalid!
Error: Chip address invalid!
P:%d, I:%d, D:%d, SampleRate:%d seconds, ST_CPU:%d, ST_ADT7463:%d, ST_DauBoard:%d 
Wt_CPU:%d, Wt_ADT7463:%d, Wt_DauBoard:%d
Tolerance:%d MinPwm:0x%x 
fork return error
getlimit return error
Max number of open file descriptor is 0!
setsid return error
Failed to create second child by fork.
chdir retrun error
/dev/null
Warning - write failed
PID controller error
/dev/i2c/%d
/dev/i2c-%d
Error: Could not open file `/dev/i2c-%d' or `/dev/i2c/%d': %s
Error: Could not open file `%s': %s
Run as root?
/proc/bus/i2c
  Installed I2C busses:
    %s
/proc/mounts
%[^ ] %[^ ] %[^ ] %*s
sysfs
/class/i2c-dev
%s/%s/name
%s/%s/device/name
%s/%s/device
i2c-
%s/%s/device/%s/name
ISA 
i2c-%d
%s      %-10s   %-32s   %s
    %s  %-10s   %s
Error: No I2C busses found!
Be sure you have done 'modprobe i2c-dev'
and also modprobed your i2c bus drivers
dummy
Dummy bus algorithm
ISA bus algorithm
Algorithm unavailable
smbus
Non-I2C SMBus adapter
unknown
GCC: (GNU) 4.3.2
GCC: (GNU) 4.3.2
GCC: (sdk3.3-ct-ng-1.4.1) 4.3.2
GCC: (sdk3.3-ct-ng-1.4.1) 4.3.2
GCC: (sdk3.3-ct-ng-1.4.1) 4.3.2
GCC: (GNU) 4.3.2
GCC: (sdk3.3-ct-ng-1.4.1) 4.3.2
GCC: (GNU) 4.3.2
aeabi
.shstrtab
.interp
.note.ABI-tag
.hash
.dynsym
.dynstr
.gnu.version
.gnu.version_r
.rel.dyn
.rel.plt
.init
.text
.fini
.rodata
.ARM.exidx
.eh_frame
.init_array
.fini_array
.jcr
.dynamic
.got
.data
.bss
.comment
.ARM.attributes

Re: NSA325 fan control
October 07, 2019 05:23PM
I changed the i2c section in the kirkwood-nsa325.dtb to the following below (pure guess work based on some similar dts files so this is probably incorrect!). Now the lm85 module gets loaded on boot and sensor-detect does say there is a adt7463 sensor. However pwmconfig does not change the fan rpm and fancontrol does not work.

		i2c@11000 {
			compatible = "marvell,mv64xxx-i2c";
			reg = < 0x11000 0x20 >;
			#address-cells = < 0x01 >;
			#size-cells = < 0x00 >;
			interrupts = < 0x1d >;
			clock-frequency = < 0x186a0 >;
			clocks = < 0x03 0x07 >;
			pinctrl-0 = < 0x07 >;
			pinctrl-names = "default";
			status = "okay";

			pcf8563@51 {
				compatible = "nxp,pcf8563";
				reg = < 0x51 >;
			};
			
                       adt7463@2e {
				compatible = "lm85,adt7463";
				reg = < 0x2e >;
			};
			
			};

root@debian:~# lsmod
Module                  Size  Used by
ipv6                  434176  32
lm85                   32768  0
hwmon_vid              16384  1 lm85
sg                     32768  0
orion_wdt              16384  0
marvell_cesa           36864  0
kirkwood_thermal       16384  0
evdev                  24576  0
uio_pdrv_genirq        16384  0
uio                    20480  1 uio_pdrv_genirq
uas                    20480  0
fixed                  16384  0
gpio_keys              20480  0


root@debian:~# pwmconfig 
# pwmconfig revision $Revision$ ($Date$)
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.

We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.

Found the following devices:
   hwmon0 is kirkwood_thermal
   hwmon1 is adt7463

Found the following PWM controls:
   hwmon1/pwm1           current value: 250
   hwmon1/pwm2           current value: 250
   hwmon1/pwm3           current value: 250

Giving the fans some time to reach full speed...
Found the following fan sensors:
   hwmon1/fan1_input     current speed: 84 RPM
   hwmon1/fan2_input     current speed: 84 RPM
   hwmon1/fan3_input     current speed: 84 RPM
   hwmon1/fan4_input     current speed: 84 RPM

Warning!!! This program will stop your fans, one at a time,
for approximately 5 seconds each!!!
This may cause your processor temperature to rise!!!
If you do not want to do this hit control-C now!!!
Hit return to continue: 

Testing pwm control hwmon1/pwm1 ...
  hwmon1/fan1_input ... speed was 84 now 84
    no correlation
  hwmon1/fan2_input ... speed was 84 now 84
    no correlation
  hwmon1/fan3_input ... speed was 84 now 84
    no correlation
  hwmon1/fan4_input ... speed was 84 now 84
    no correlation

No correlations were detected.
There is either no fan connected to the output of hwmon1/pwm1,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)

Did you see/hear a fan stopping during the above test (n)? n

Testing pwm control hwmon1/pwm2 ...
  hwmon1/fan1_input ... speed was 84 now 84
    no correlation
  hwmon1/fan2_input ... speed was 84 now 84
    no correlation
  hwmon1/fan3_input ... speed was 84 now 84
    no correlation
  hwmon1/fan4_input ... speed was 84 now 84
    no correlation

No correlations were detected.
There is either no fan connected to the output of hwmon1/pwm2,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)

Did you see/hear a fan stopping during the above test (n)? n

Testing pwm control hwmon1/pwm3 ...
  hwmon1/fan1_input ... speed was 84 now 84
    no correlation
  hwmon1/fan2_input ... speed was 84 now 84
    no correlation
  hwmon1/fan3_input ... speed was 84 now 84
    no correlation
  hwmon1/fan4_input ... speed was 84 now 84
    no correlation

No correlations were detected.
There is either no fan connected to the output of hwmon1/pwm3,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)

Did you see/hear a fan stopping during the above test (n)? n

Testing is complete.
Please verify that all fans have returned to their normal speed.

The fancontrol script can automatically respond to temperature changes
of your system by changing fanspeeds.
Do you want to set up its configuration file now (y)? n
root@debian:~# 

Re: NSA325 fan control
October 07, 2019 06:14PM
Hi Koen,

I don't think we can control the fan directly through lm-sensors on this box.

I have this in my login profile to read the fan speed and CPU temperature.

if [ "$MACHINE" == "ZyXEL NSA325" ]; then
	echo "CPU Temperature" $(($(/usr/sbin/i2cget -y 0x0 0x0a 0x07))) "C"
	echo "Fanspeed" $[60000/$(($(/usr/sbin/i2cget -y 0x0 0x0a 0x08)))] "RPM"
fi

I think to control the fan on this box, you will need to write a daemon script to monitor the readdings using ic2get, and then use i2cset to change the fan speed, or to shutdown the box when the CPU temp get to a certain threshold.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA325 fan control
October 08, 2019 03:09PM
Hi Bodhi,

thanks for the info. I may have a look at writing a script once I've got some more spare time.

Koen
Re: NSA325 fan control
October 08, 2019 03:10PM
Wait a sec. So the thing can be actually controlled? I thought it was not.

I don't know if the chip is the same as on the nsa310 (smaller NAS of the same family, also a Kirkwood), but if the thermal/fan controller chip is the same, then you only need to send it thermal limits and fan pwm on boot time, the controller is capable of fan control on its own.

This is also what the initial part of the script (the commented out parts) seems to be doing. It's sending the high/low limits in hex through i2cset
# PWMx at Min Duty Cycle while temp < T_min
# PWM_min = 25%, if temp is below T_min, fan will operate with 25% duty cycle
# T_min = 25
# THERM Limit = 55 degree C, if exceeded this, fan will operate with 100% duty cycle, full speed

I don't understand what it is trying to do after that. It seems to set again some limits and then gives control over some binary application.


On OpenWrt, for the NSA310 I used a script (which was then renamed and the commit history is lost for some reason) that loads these values on boot, using the infrastructure exposed by lm85 kernel module. I can confirm that this does work on nsa310.

https://github.com/openwrt/openwrt/blob/master/target/linux/kirkwood/base-files/etc/init.d/hwmon_fancontrol
Re: NSA325 fan control
October 08, 2019 06:03PM
> Wait a sec. So the thing can be actually
> controlled? I thought it was not.

The above script in Koen post seems to indicate it could be use for ADT7463 sensor.

I've never tried i2cset on the NSA325 so not sure.

The NSA310 has the sensor defined in the DTS, therefore it can be seen by lm-sensors.

On the NSA320, and NSA325, it is not defined in the DTS, so we can't use lm-sensors. Everything is must be done through i2c.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA325 fan control
October 09, 2019 01:33PM
Hi all,

I think the name of the script has been a 'red herring'. The data sheet shows the ADT7463 has 24 pins and I have inspected the board and I can see only 1 chip with 24 pins. The 24 pin chip on the board is not an ADT7463 but has the following label: Holtek HT66F30. The data sheet of that microcontroller can be found here:

https://datasheet.lcsc.com/szlcsc/Holtek-Semicon-HT66F30-1_C139962.pdf

This chip seems to have a lot of different capabilities including watch dog timer, PWM, comparator etc. So it could be that this chip does the thermal management but it is not as advanced as the ADT7463. I guess that may explain why the script does some initialisation and then hands over control to the /sbin/fanctrld binary.

So I guess that means there is no point in trying to get lm-sensors to work and the only way to control the fan is by using a custom script which polls the temperature and adjusts the rpm.

Koen
Re: NSA325 fan control
October 09, 2019 02:20PM
Thanks Koen,

> I think the name of the script has been a 'red
> herring'. The data sheet shows the ADT7463 has 24
> pins and I have inspected the board and I can see
> only 1 chip with 24 pins. The 24 pin chip on the
> board is not an ADT7463 but has the following
> label: Holtek HT66F30.

Good to know!

> the thermal management but it is not as advanced
> as the ADT7463. I guess that may explain why the
> script does some initialisation and then hands
> over control to the /sbin/fanctrld binary.

That could be it.

The MCU in this box controls a lot of things that made it hard to see. For example the network chip is also "affected" by it.

I remember WarheadSE figured out the network bring up sequence in this u-boot, that sequence just so convoluted. It's also in the kernel patch, if you're interested to take a look.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA325 fan control
October 10, 2019 04:25PM
When I run i2cdetect it gives the following output:

root@debian:~# i2cdetect -y 0x0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- 0a -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: 50 UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- 64 -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --


0x0a has the 2 values which are the fan rpm and temperature as shown by the code that bohdi posted earlier.

root@debian:~# i2cdump -y 0x0 0x0a    
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: ff ff ff ff ff ff ff 24 18 ff ff ff ff ff ff ff    .......$?.......
10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................


0x51 is not accessible since it is the real time clock

0x64 shown up in i2cdetect but i2cdump does not show anything.

root@debian:~# i2cdump -y 0x0 0x64
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX


0x50 has some values in it:

root@debian:~# i2cdump -y 0x0 0x50
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: fc f5 28 31 05 8c 00 00 ff ff ff ff ff ff ff ff    ??(1??..........
10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
root@debian:~# 

root@debian:~# i2cget -y 0x0 0x50 0x0  
0xfc
root@debian:~# i2cget -y 0x0 0x50 0x1
0xf5
root@debian:~# i2cget -y 0x0 0x50 0x2
0x28
root@debian:~# i2cget -y 0x0 0x50 0x3
0x31
root@debian:~# i2cget -y 0x0 0x50 0x4
0x05
root@debian:~# i2cget -y 0x0 0x50 0x5
0x8c
root@debian:~# i2cget -y 0x0 0x50 0x6
0x00
root@debian:~# i2cget -y 0x0 0x50 0x7
0x00

I've changed these values using i2cset but none of them seem to have an effect on the fan rpm. So I'm not sure how to change the fan speed.

Koen
Re: NSA325 fan control
March 25, 2021 03:33PM
Koen Wrote:
-------------------------------------------------------
> When I run i2cdetect it gives the following
> output:
>
>
> root@debian:~# i2cdetect -y 0x0
>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e 
.
.
.
.

> 
> root@debian:~# i2cdump -y 0x0 0x50
> No size specified (using byte-data access)
>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e 
> f    0123456789abcdef
> 00: fc f5 28 31 05 8c 00 00 ff ff ff ff ff ff ff

On my NSA320 this is the ethadr of my box

> ff    ??(1??..........
> 10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
> f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ff    ................
.
.
.
.

>
>
> I've changed these values using i2cset but none of
> them seem to have an effect on the fan rpm. So I'm
> not sure how to change the fan speed.
>
> Koen



Edited 1 time(s). Last edit at 03/25/2021 03:35PM by bandicoot.
Re: NSA325 fan control
March 25, 2021 06:48PM
bandicoot,

I don't think we know how to change fan speed on Zyxel NSA325.

The NSA320 has hwmon module and it might be different (i.e. possible?) I forgot whether that module can change fan speed).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA325 fan control
March 25, 2021 08:45PM
bodhi,

I think none of the zyxel's is capable of fan speed, only on or off as far as I could find on the internet. This should be the case for NSA320, NSA325 and NSA326, and maybe also for the NSAXXXs versions.

I have an NSA320 and the fan is not turned on, so I am wondering if I can turn it on myself, I do see the temperature.

Cheers
Re: NSA325 fan control
March 26, 2021 09:11PM
bandicoot ,

> I think none of the zyxel's is capable of fan
> speed,

Correct. The Zyxel NAS fan speed is automatically controlled by sensor. So it will kick in at high RPM when the temperature raises.

> I have an NSA320 and the fan is not turned on, so
> I am wondering if I can turn it on myself, I do
> see the temperature.
>

It should be on automatically after booted.

===

The only way (if any) to manipulate fan speed is with i2c set command.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 03/26/2021 09:22PM by bodhi.
Re: NSA325 fan control
August 08, 2022 06:54AM
Hi guys,

did you ever get anywhere with this? I am interested in the NSA325 and NSA320.

Cheers,

chessplayer

---
Standart ist der Standardfehler
Re: NSA325 fan control
August 08, 2022 04:32PM
At the moment, you can only read the fan speed on those boxes, but not controlling it (it is automatically adjusted by hardware). Nobdy has found an i2c command to controlling the fan.

Wiki thread:

Quote

Sensors & Fan & WOL

OWFSPlug : 1-Wire File System + Motion Detection Software in a NAND Package
OWFS & Motion Detection (external link)
How to control GPIO in Linux userspace for GPIO-enable fan
Zyxel NSA 310S/320S/325/326 CPU Temperature and Fan Speed reading
Zyxel NAS326 WOL
Zyxel NAS325 Auto-Power Up
Zyxel NAS326 WOL and Auto-Power Up I2C commands
Zyxel NSA320 Auto-Power Up
Setup lm-sensors (example for Lenovo IX2 DL fan control in Debian)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA325 fan control
September 01, 2022 12:06PM
As far as I remeber the 325 fan has only two wires so I don't think it can be controlled in RPM.

I think the only way is to change the supply voltage via its controller board as a function of the internal temperature.
Re: NSA325 fan control
September 01, 2022 03:00PM
miazza Wrote:
-------------------------------------------------------
> As far as I remeber the 325 fan has only two wires
> so I don't think it can be controlled in RPM.
>
> I think the only way is to change the supply
> voltage via its controller board as a function of
> the internal temperature.

+1

I'm guessing that's what this box MCU does.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA325 fan control
September 01, 2022 10:17PM
The nsa320-hwmon kernel module is supposed to be able to handle the MCU on both the NSA320 and NSA325.

Ray
Re: NSA325 fan control
September 01, 2022 11:04PM
> The nsa320-hwmon kernel module is supposed to be
> able to handle the MCU on both the NSA320 and
> NSA325.

Not really. That's only for the NSA320.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA325 fan control
September 02, 2022 07:45PM
I haven't tried it as I did not have an NSA325 at the time (and NAS Central is no longer online), but I recall someone indicating that the gpio lines for the MCU on NSA325 and NSA320 were identical (verified by inspection of both dts files). They apparently were able to add the appropriate node to the NSA325 dts and get the nsa320-hwmon to work with the NSA325 as well. https://cateee.net/lkddb/web-lkddb/SENSORS_NSA320.html also mentions "If you say yes here you get support for hardware monitoring for the ZyXEL NSA320 Media Server and other compatible devices (probably the NSA325 and some NSA310 variants)."

So potentially adding:
hwmon {
		compatible = "zyxel,nsa320-mcu";
		pinctrl-0 = <&pmx_mcu_data &pmx_mcu_clk &pmx_mcu_act>;
		pinctrl-names = "default";

		data-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
		clk-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
		act-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
	};
to the nsa325 dts file would allow using the nsa320-hwmon module.

I now have an NSA325 here somewhere so may give it a try once I locate the device.
Re: NSA325 fan control
September 03, 2022 01:09AM
> but I recall someone indicating that the gpio
> lines for the MCU on NSA325 and NSA320 were
> identical (verified by inspection of both dts
> files). They apparently were able to add the
> appropriate node to the NSA325 dts and get the
> nsa320-hwmon to work with the NSA325 as well.

Try whatever you can think of to see if you can control the fan speed through that hwmon :) you have nothing to lose but time.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: