Welcome! Log In Create A New Profile

Advanced

NSA310 fan speed

Posted by sebr 
NSA310 fan speed
February 09, 2016 06:25PM
I just set up a NSA310 (not "s") with the latest jessie rootfs, kernel 4.4 and latest uboot. So far I got everything working like LEDs, buttons etc. But how can I control the fan speed? It is always running at max. rpm.
Re: NSA310 fan speed
February 09, 2016 08:37PM
sebr Wrote:
-------------------------------------------------------
> I just set up a NSA310 (not "s") with the latest
> jessie rootfs, kernel 4.4 and latest uboot. So far
> I got everything working like LEDs, buttons etc.
> But how can I control the fan speed? It is always
> running at max. rpm.

See this thread:
http://forum.doozan.com/read.php?2,24655,25760#msg-25760n

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA310 fan speed
February 10, 2016 10:41AM
Thanks für your reply. This thread is about the hwmon module. But for now I am just trying to set the fanspeed on the NSA310 which is simply done by writing to
/sys/class/i2c-adapter/i2c-0/0-002e/pwm1
like it is done here: click and there: click

But that doesn't work.
Re: NSA310 fan speed
February 10, 2016 11:49AM
sebr,

I think the new hwmon module that was patched for NSA320 might work for NSA310. I'll let pbg4 explain further whether it is possible.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA310 fan speed
February 10, 2016 06:04PM
Does the NSA320 have the ability to control the fanspeed by software? Afaik only the NSA310 has this capability among all the Zyxel devices.
Re: NSA310 fan speed
February 11, 2016 11:15AM
Hi sebr,

there is some discussion about fan control in nas-central zyxel forums, someone also wrote a small
fan control daemon for NSA310 which you could use, perhaps you should have a look there,

https://github.com/lzap/fan3xxnsa

and more discussion here:

http://forum.nas-central.org/viewtopic.php?f=249&t=7405

since the NSA310 ( at least the first version produced by zyxel) has a real sensor chip lm85
connected to i2c bus this should be the way to go, the NSA320 is completely different and has the
holtek mcu which needs nsa3xx-hwmon module to read out temperature and device fan speed,

best wishes pbg4
Re: NSA310 fan speed
February 11, 2016 03:05PM
Hello pbg4, this is the link I posted above already and installing fan3xxnsa has no effect on the fanspeed.

Reading through the instructions there at least should be able to set the fanspeed manually by
echo 1 > /sys/class/i2c-dev/i2c-0/device/0-002e/pwm1_enable

echo 0 > /sys/class/i2c-dev/i2c-0/device/0-002e/pwm1
This should turn the fan off but doesn't. Any ideas why?
Re: NSA310 fan speed
February 12, 2016 06:27AM
Hi sebr,

since the NSA310 has an lm85 compatible sensor chip i.e. an ADT7476 it
should theoretically be able to control the fan by sending out a pwm modulated
voltage to the fan, so pwmconfig and fancontrol from lm-sensors package should
work with the right values in /etc/fancontrol,..

BUT: if you look at the pcb picture here http://masu.6f.sk/index.php?title=Nsa310_pcb there are a lot!!
of unpopulated resistor and transistor positions between the fan header and the thermal monitoring
chip, so may be zyxel engineers again saved a few bucks and implemented only the absolute
minimum in hardware and in firmware,.. to read out the temp and fan speed, trigger the beeper at 80 degree Celsius
and shutdown when it gets hotter, as there are some reports in the internet that someone managed to get
fancontrol working it is possible that different versions of the pcb were manufactured as usual,..

if you can't get it working even with the correct values in /etc/fancontrol and you really want to know
what is going on, you have to take out the pcb and route the way from the fan header to the ADT7476
with an ohm meter and get a datasheet of it, to see wether the pwm output pins are really connected,..

but that is all I can say since I only have two NSA320 boxes, that is why I made the first patch for nsa3xx-hwmon,..
and their design is even more simplistic concerning fan speed than the NSA310,..

best wishes pbg4
Re: NSA310 fan speed
February 12, 2016 06:33PM
Thanks for you answer. sensors is able to read the rpm of the fan but not able to set the fanspeed (checked with pwmconfig). The adt7475 module is loaded.
Since I was running the NSA310 for a while with the stock firmware I can assure you that there is a fancontrol in software. Also now since running debian on the device the fan is constantly spinning at max rpm is evidence to me that the fanspeed is (was) controlled by software.
If you take a look into the scripts for NSA310 fancontrol then they simply write to pwm1_enable and pwm to set the fanspeed. But that does not work.
I just checked the fan and it has 3 wires so I assume the fan ist simply voltage-controlled without a real pwm (just chopped DC). The board has an LM9600: http://pdf1.alldatasheet.com/datasheet-pdf/view/93712/NSC/LM96000.html


Also I noticed when installing the 4.4 kernel that there are two dts files for the NSA310. What is the difference between kirkwood-nsa310.dtb and kirkwook-nsa310a.dtb ?



Edited 2 time(s). Last edit at 02/12/2016 06:52PM by sebr.
Re: NSA310 fan speed
February 14, 2016 07:08AM
Hi,

the lm9600 has three pwm1,2,3 output pins, have you tested the other pwm2 and pwm3 also?
from the lm9600 pdf you linked on p.27 application diagram it is clear, that if there is no
low pwm output voltage the basis of the transistor regulateing the fan voltage is pulled high
by the 470 ohm resistor and the fan is on full speed,..

the nsa310 and nsa310a dts files simply differ because one variant of NSA310 does not have
a red usb led, so in the nsa310a dts the mpp16 and gpio16 which drive the led are left out,
nsa310a has a natsemi lm85 also at i2c address 0x2e, otherwise they are identical,..

have you tried if the lm9600 is perhaps supported by the lm85.ko kernel module instead ?

best wishes pbg4



Edited 2 time(s). Last edit at 02/14/2016 11:53AM by pbg4.
Re: NSA310 fan speed
February 14, 2016 11:34AM
Hi,
I have disassembled he device and verified that the circuitry to control the fan speed is identical with the application note in the datasheet and connected to pwm1 / tach1. The other pwm outputs not do anything. According to the datasheet. after power-on, the initial pwm duty cycle is 100%.
The LM9600 is listed as compatible with the lm85 module, see here: https://web.archive.org/web/20150813204337/http://www.lm-sensors.org/wiki/Devices
I verified with i2cdetect that it is on default address 0x2e. So I blacklisted the adt7475 module and loaded the lm85 module instead. pwmconfig gave me this error: "No sensors found! (modprobe sensor modules?)"

Obviously there is another variant of the nsa310 around: with red USB LED and the lm85-compatible sensor!
So I assume I'm out of luck for now as there is no dts file to address this hardware?!
Re: NSA310 fan speed
February 14, 2016 11:52AM
Hi,
if you forget for a while the minor led differences, than the real difference in kirkwood-nsa310a.dts is

		i2c@11000 {
			status = "okay";

			lm85: lm85@2e {
				compatible = "national,lm85";
				reg = <0x2e>;
			};

whereas in kirkwood-nsa310.dts there is

		i2c@11000 {
			status = "okay";

			adt7476: adt7476a@2e {
				compatible = "adi,adt7476";
				reg = <0x2e>;
			};

have you tested loading kirkwood-nsa310a.dtb into the kernel and rebooted, so this device description is active
from the very start of the kernel and should trigger loading lm85 kernel module?

best wishes pbg4
Re: NSA310 fan speed
February 14, 2016 12:56PM
I can confirm that with kirkwood-nsa310a.dtb the hardware monitoring and fancontrol works flawless :-)
Readout of three temps and setting the pwm output can all be achieved by lm85.
As expected no red USB LED in /sys/class/leds anymore.
So obvisouly there are at least three variants of the NSA310.
Re: NSA310 fan speed
February 15, 2016 02:48PM
Also my NSA310 needs the kirkwood-nsa310a.dtb to see the sensor/temps and control the fan.

Thank you both.

Was getting worried my box was one of the screwed ones. :)
Re: NSA310 fan speed
February 15, 2016 06:08PM
Yours also has the red USB LED ?
Re: NSA310 fan speed
February 16, 2016 03:34PM
All leds on my board are both red and green, when it powers on and is beginning boot all leds are red.

From inside Debian I can only trigger green light for usb. All other leds can be triggered red or green.

root@nsa310debian:/sys/class/leds# ls
.                  nsa310:green:esata  nsa310:green:usb  nsa310:red:hdd
..                 nsa310:green:hdd    nsa310:red:copy   nsa310:red:sys
nsa310:green:copy  nsa310:green:sys    nsa310:red:esata

With kirkwood-nsa310.dtb lm-sensors does not detect anything, with kirkwood-nsa310a.dtb it detects the lm85, and I did set up fancontrol to keep the damn fan quiet. And it works.


Btw, no leds are switched on by default in my Debian. Need to activate them manually with a few lines in rc.d file (I think).
Re: NSA310 fan speed
February 17, 2016 06:37PM
Thats the same model as mine then: lm85 and red USB LED.
Would be nice if bodhi can provide a third variant of the dts file along with the next kernel release.
So far I can live without the red USB LED but got the fan tamed :)
Re: NSA310 fan speed
February 17, 2016 07:04PM
> Thats the same model as mine then: lm85 and red
> USB LED.
> Would be nice if bodhi can provide a third variant
> of the dts file along with the next kernel
> release.
> So far I can live without the red USB LED but got
> the fan tamed :)

Sure I will :) But before doing that I would like you guys to post the definitive info about the variants. Currently NAS Central has listed 2 (original and TDHome). It also mentioned:

Quote

According to the GPL sources there are at least 3 different versions, the TDC, the OBM and the SGW.

And it seems you've found the 3rd one! So please list the model and DTS file names here.

Quote

kirkwood-nsa310.dts model? sensor-supported=no LED?
kirkwood-nsa310a.dts model? sensor-supported=lm85 LED?

Let say we are adding "b" version:

Quote

kirkwood-nsa310b.dts model? sensor-supported? LED?

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



Edited 1 time(s). Last edit at 02/17/2016 07:07PM by bodhi.
Re: NSA310 fan speed
February 18, 2016 07:44AM
Hi,

@sebr:

to generate a suitable kirkwood-nsa310b.dts for testing you only have to patch
the code block for i2c and lm85 which I posted above into kirkwood-nsa310.dts
which has all the leds assigned,

than compile kirkwood-nsa310b.dtb, load it in the kernel and test, and report back,

maybe some finetuning of mpps and gpios is necessary, but most probably not since
I diffed both versions already to see what is going on, in kirkwood-nsa310a.dts
the mpp16 and gpio16 definitions which drive the led are left out,

best wishes pbg4
Re: NSA310 fan speed
February 19, 2016 06:52AM
>So please list the model and DTS file names here.

Can you explain a bit more in detail? What do you want me to do? :)

Also, what about more intuitive names for dts files? adding a b or c does not tell me what the differences are.



Edited 1 time(s). Last edit at 02/19/2016 07:04AM by bobafetthotmail.
Re: NSA310 fan speed
February 19, 2016 03:32PM
bobafetthotmail Wrote:
-------------------------------------------------------
> >So please list the model and DTS file names
> here.
>
> Can you explain a bit more in detail? What do you
> want me to do? :)
>

I need to describe the difference between the 3rd version of the DTS and the exisiting 2 DTS. And how would users determine if they should use this 3rd version to get their box running correctly.

kirkwood-nsa310.dts: for orginal Zyxel 310.
kirkwood-nsa310a.dts: for TDC Home
kirkwood-nsa310b.dts: for ???

> Also, what about more intuitive names for dts
> files? adding a b or c does not tell me what the
> differences are.

That are mainline file names for these 2 files :) So eventhough it is a bad convention, I just thought we want to be consistent so people who search will find it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA310 fan speed
February 19, 2016 06:26PM
>I need to describe the difference between the 3rd version of the DTS and the exisiting 2 DTS.

The new dts needs to have a red USB led, just like the first dts has (and works if I load it).

The new dts needs to have lm85 sensor, like the second dts has (and works if I load it).

As pbg4 said, you probably just need to splice the two relevant entries of the existing dts into a new dts.

>how would users determine if they should use this 3rd version to get their box running correctly.

If with stock firmware they could control fan or it was less noisy ---> either a or b
If on boot they see all leds red ---> b

Sorry but there isn't any clear indication on the box nor on the board. no V1 or V2 or V3 or nothing.

>That are mainline file names for these 2 files :)

I know. My point still stands. Adding letters after names is silly and should be avoided.
Re: NSA310 fan speed
February 19, 2016 07:06PM
bobafetthotmail,

> I know. My point still stands. Adding letters
> after names is silly and should be avoided.

I do agree.

> Sorry but there isn't any clear indication on the
> box nor on the board. no V1 or V2 or V3 or
> nothing.
>

But obviously the above was probably the reason for the DTS author to have named them that way? We know what's in the kirkwood-nsa310.dts. What would be a good DTS name for kirkwood-nsa310a.dts version and the 3rd version?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA310 fan speed
February 20, 2016 05:31AM
Ah, forgot about the i2c. the b version needs both lm85 and i2c for fancontrol. As explained by pbg4 anyway, but making sure just in case.

>But obviously the above was probably the reason for the DTS author to have named them that way?

It's possible that that the names were placeholders, but then none cared about them and they remained like that.
Since we found a (the) third variant, I hope upstream realizes that having sane naming scheme is needed here even if it will break compatibility (people will need to alter their u-boot envs to boot the dts with a new name, which imho isn't a big deal, and might even be beneficial as someone might even discover that his box can fancontrol).

>What would be a good DTS name for kirkwood-nsa310a.dts version and the 3rd version?

I'd use self-explanatory names (hoping I'm not hitting name length limitations I'm not aware of):

kirkwood-nsa310-redledusb.dts (the current vanilla version)

kirkwood-nsa310-fancontrol.dts (this is the current a version)

kirkwood-nsa310-redledusb-and-fancontrol.dts (the proposed b version)



Edited 2 time(s). Last edit at 02/20/2016 12:18PM by bobafetthotmail.
Re: NSA310 fan speed
March 15, 2016 04:59AM
Please try this DTB file for the 3rd variant of the NSA310.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Attachments:
open | download - kirkwood-nsa310b-lmsensor-redusbled.dtb (12.3 KB)
pld
Re: NSA310 fan speed
March 15, 2016 05:05PM
Hi there,

My NSA310 is equipped with ADT7476. In the documentation I found:

Fan Speed Control
-----------------

The driver exposes two trip points per PWM channel.

point1: Set the PWM speed at the lower temperature bound
point2: Set the PWM speed at the higher temperature bound

The ADT747x will scale the PWM linearly between the lower and higher PWM
speed when the temperature is between the two temperature boundaries.
Temperature boundaries are associated to temperature channels rather than
PWM outputs, and a given PWM output can be controlled by several temperature
channels. As a result, the ADT747x may compute more than one PWM value
for a channel at a given time, in which case the maximum value (fastest
fan speed) is applied. PWM values range from 0 (off) to 255 (full speed).

Fan speed may be set to maximum when the temperature sensor associated with
the PWM control exceeds temp#_max.

Did anyone of you try to use the automatic fan speed control function?

--

Regards
PLD = Polish(ed) Linux Distribution, www.pld-linux.org
Re: NSA310 fan speed
March 26, 2016 12:31PM
>Please try this DTB file for the 3rd variant of the NSA310.

oops, saw it only now. Will test it in a few days.

>Did anyone of you try to use the automatic fan speed control function?

No. You have any idea of how to control this function?

Does it generate entries in /sys/something/something where you can write values into (like the led control drivers)?
Re: NSA310 fan speed
March 28, 2016 05:33AM
With the proper dts file for your variant of the NSA310 controlling the fanspeed works flawless. Just run sensors-detect and then configure with pwmconfig.
Re: NSA310 fan speed
March 28, 2016 06:50AM
No, he is talking of using a hardware function of the ADT747x itself.

pwmconfig sets up the configuration of fancontrol, a script run in a loop, that checks temps and changes pwm speeds if needed.

It seems that the ADT747x can do the same on its own, without the script, by just setting up temps somehow.
Re: NSA310 fan speed
March 29, 2016 12:14PM
@bodhi: with the dtb now I can activate the red usb led AND control the fan speed. Everything seems OK.
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: