DESK-XZ7-L/Peripherals/Temperature sensor

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2024/01/23 DESK-XZ7-L-1.0.1 release



Peripheral Temperature sensors[edit | edit source]

BORA and BORA Xpress SOMs has a TMP421AIDCN temperature sensor onboard.

Accessing the peripheral[edit | edit source]

The temperature information can be accessed through the sysfs interface:

read the PCB temperature[edit | edit source]

root@bora:~# cat /sys/devices/soc0/axi/e0004000.i2c/i2c-0/0-004f/hwmon/hwmon1/temp1_input

the returned value has to be divided by 1000 for a °C temperature

read the CPU temperature[edit | edit source]

root@bora:~# cat /sys/devices/soc0/axi/e0004000.i2c/i2c-0/0-004f/hwmon/hwmon1/temp2_input

the returned value has to be divided by 1000 for a °C temperature

internal SoC temperature[edit | edit source]

Moreover, the SoC has an internal temperature sensor device which can be read using the following shell script:

root@bora:~# cat temp.sh
#!/bin/sh

# Tcpu
TEMP_RAW=`cat /sys/devices/soc0/axi/f8007100.adc//iio\:device1/in_temp0_raw`
TEMP_OFFSET=`cat /sys/devices/soc0/axi/f8007100.adc//iio\:device1/in_temp0_offset`
TEMP_SCALE=`cat /sys/devices/soc0/axi/f8007100.adc//iio\:device1/in_temp0_scale`
TEMP=`awk "BEGIN {print (($TEMP_RAW+$TEMP_OFFSET)*$TEMP_SCALE)/1000}"`

echo "Cpu Temp: ${TEMP}"
root@bora:~# chmod u+x temp.sh
root@bora:~# ./temp.sh
Cpu Temp: 46.0172