does the board contains thermal sensor(s) ?

Any technical questions about the Epiphany chip and Parallella HW Platform.

Moderator: aolofsson

does the board contains thermal sensor(s) ?

Postby toralf » Thu Feb 06, 2014 4:48 pm

I'm just curious if they should be seen under /sys/devices/system/cpu/cpu?/thermal_throttle, /sys/class/hwmon/hwmon\?/temp\?_input or ?
toralf
 
Posts: 8
Joined: Thu Nov 07, 2013 3:41 pm

Re: does the board contains thermal sensor(s) ?

Postby timpart » Thu Feb 06, 2014 5:43 pm

The Zynq chip has an internal sensor that can be connected to its ADC. I've no idea what OS drivers are available though. Since the ADC can also sense external connections, a driver might not be installed by default to avoid misunderstandings.

Tim
Last edited by timpart on Thu Feb 06, 2014 11:28 pm, edited 1 time in total.
timpart
 
Posts: 302
Joined: Mon Dec 17, 2012 3:25 am
Location: UK

Re: does the board contains thermal sensor(s) ?

Postby ubii » Thu Feb 06, 2014 8:25 pm

After digging through numerous Xilinx resources, I discovered the following three sysfs entries, which appear to monitor the temperature of the Zynq chip.

/sys/bus/iio/devices/iio:device0/in_temp0_raw
/sys/bus/iio/devices/iio:device0/in_temp0_offset
/sys/bus/iio/devices/iio:device0/in_temp0_scale

The XADC Core API does provide the "xadc_get_value_temp" command to retrieve the current temperature in Celcius, but unfortunately does not appear to be installed. From what I can tell, you should be able to calculate the temperature in Celcius, using the following equation.

T = ((in_temp0_raw + in_temp0_offset) * in_temp0_scale) / 1000)

Readings from my Gen 1.1 Parallella-16 running idle, inside the standard case, with no external fan:

in_temp0_raw = 3156
in_temp0_offset = -2219
in_temp0-scale = 123.040771484

T = ((3156 + (-2219)) * 123.040771484) / 1000)
T = 115.3 C
T = 239.5 F

Readings from my Gen 1.1 Parallella-16 running idle, inside the standard case, with external fan:

in_temp0_raw = 2760
in_temp0_offset = -2219
in_temp0-scale = 123.040771484

T = ((2760 + (-2219)) * 123.040771484) / 1000)
T = 66.6 C
T = 151.9 F

Please note, that the ambient temperature for both tests was a toasty 30 C (86 F), which is why both values are rather high.

Hopefully, the folks at Adapteva can confirm my findings and possibly provide us with a better method to calculate these values. Assuming that my findings are correct, I will probably write a simply C program to do the calculations or find a way to get this to work with lm_sensors.
User avatar
ubii
 
Posts: 71
Joined: Sun Dec 16, 2012 7:18 pm
Location: US

Re: does the board contains thermal sensor(s) ?

Postby timpart » Fri Feb 07, 2014 7:17 am

The Xilinx UG480 7 Series FPGAs and Zynq-7000 All Programmable SoC XADC Dual 12-Bit 1 MSPS Analog-to-Digital Converter User Guide gives the formula on page 30

Temperature in C = (raw_value / 4096 * 503.975) - 273.15

(It also explains the numbers in terms of physical constants if you are interested.)

Tim
timpart
 
Posts: 302
Joined: Mon Dec 17, 2012 3:25 am
Location: UK

Re: does the board contains thermal sensor(s) ?

Postby ubii » Fri Feb 07, 2014 8:15 am

Timpart,

The formula that I used, was found on the Analog Devices WIKI (http://wiki.analog.com), which I stumbled upon, once I discovered that the temperature sensor was using IIO to output the readings to sysfs.

This is where I discovered the following information:

--------------------------------------------------------------------------
in_temp0_offset = offset for temperature sensor channel
in_temp0_raw = raw temperature channel value
in_temp0_scale = scale for the temperature sensor channel

A channel value can be read from its _raw attribute. The value returned by the _raw attribute is the raw value as reported by the device. To get the processed value of the channel in a standardized unit add the channels _offset attribute to the _raw value and multiply the result by _scale attribute. If no _offset attribute is present assume 0 for the offset.

processed value = (raw + offset) * scale

The units by the IIO framework are:

Acceleration: Meter per Second squared
Angular velocity: Rad per second
Pressure: kilo Pascal
Voltage: milli Volts
Temperature: milli-degree Celsius
--------------------------------------------------------------------------

So, using this formula (divided by 1000 to get Celsius), it appears that it is less than 0.2 C off from the formula that you provided in the document, listed below.

http://www.xilinx.com/support/documenta ... s_XADC.pdf

Regardless of which formula is used, it appears that the default SD image does provide the ability to monitor the temperature of the Zynq chip, from within Linux.
User avatar
ubii
 
Posts: 71
Joined: Sun Dec 16, 2012 7:18 pm
Location: US

Re: does the board contains thermal sensor(s) ?

Postby shodruk » Fri Feb 07, 2014 11:43 am

Good job and thanks!! :D
On my Parallella in food container case with 1.5-inch fan (no heatsink),
idle: 63.2 C
full-load: 66.5 C
Shodruky
shodruk
 
Posts: 464
Joined: Mon Apr 08, 2013 7:03 pm

Re: does the board contains thermal sensor(s) ?

Postby timpart » Fri Feb 07, 2014 1:31 pm

I agree with the value for in_temp0_scale, but the offset isn't quite right hence the discrepancy. I make the value of the offset just over -2219.9958331. If only integers are allowed then -2220 might be better than -2219 but would very slightly underestimate the temperature.

The accuracy might be spurious anyway as originally the sensor was said to be within 4 degrees. That has since been removed from the ADC document, but not sure why.

Tim
timpart
 
Posts: 302
Joined: Mon Dec 17, 2012 3:25 am
Location: UK

Re: does the board contains thermal sensor(s) ?

Postby ubii » Fri Feb 07, 2014 3:34 pm

timpart,

Honestly, I am not going to "sweat" about such a small discrepancy, as I am just happy to finally have a way to monitor the temperature of my board. Thanks again, I really appreciate your feedback and insights on this matter.
User avatar
ubii
 
Posts: 71
Joined: Sun Dec 16, 2012 7:18 pm
Location: US

Re: does the board contains thermal sensor(s) ?

Postby aolofsson » Tue Feb 11, 2014 4:49 am

ubii:

Thank you for beating us to the punch and validating the temp sensing feature!! Given how dense the board is, I suspect many users will appreciate some kind of thermal sensing loop in the system to avoid board damage.

Andreas
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: does the board contains thermal sensor(s) ?

Postby ubii » Wed Mar 05, 2014 6:18 am

Below is a quick and simple bash script, which displays the temperature of Zynq chip in both Celsius and Fahrenheit, using the method which I previously described.

Instructions:

1) create a shell script (example: ztemp.sh) and copy/paste the following code into it, then save it

$ vi ztemp.sh

2) make the script executable

$ chmod 755 ztemp.sh

3) to run the script from the directory where it is located

$ ./ztemp.sh

Example Output:

Zynq Temp: 62.8 C / 145.0 F

Code:

#!/bin/bash
raw=`cat /sys/bus/iio/devices/iio:device0/in_temp0_raw`
offset=`cat /sys/bus/iio/devices/iio:device0/in_temp0_offset`
scale=`cat /sys/bus/iio/devices/iio:device0/in_temp0_scale`

c_temp=`echo "scale=1;(($raw + $offset) * $scale) / 1000" | bc`
f_temp=`echo "scale=1;(($c_temp * 9) / 5) + 32" | bc`

echo
echo "Zynq Temp: $c_temp C / $f_temp F"
echo
User avatar
ubii
 
Posts: 71
Joined: Sun Dec 16, 2012 7:18 pm
Location: US

Next

Return to Epiphany and Parallella Q & A

Who is online

Users browsing this forum: No registered users and 1 guest

cron