Rock 4C+ How do I get the temperature?

I have a Rock 4C+ with the last dietpi (8.20.1) . When I run the ‘cpu’ command, the temperature appears as N/A - is there a way to read it ?

jef@DietPi:~$ cpu
/boot/dietpi/func/dietpi-globals: line 1729: read: read error: 0: Invalid argument
/boot/dietpi/func/dietpi-globals: line 1729: read: read error: 0: Invalid argument

 DietPi CPU Info
 Use dietpi-config to change CPU / performance options
 Architecture |     aarch64
 Temperature  |     N/A
 Governor     |     schedutil

                 Current Freq    Min Freq   Max Freq
 CPU0         |      1008 MHz      408 MHz    1416 MHz
 CPU1         |      1008 MHz      408 MHz    1416 MHz
 CPU2         |      1008 MHz      408 MHz    1416 MHz
 CPU3         |      1008 MHz      408 MHz    1416 MHz
 CPU4         |      816 MHz      408 MHz    1800 MHz
 CPU5         |      816 MHz      408 MHz    1800 MHz

[ INFO ] DietPi-CPU_info | The current CPU frequency may be affected by processing this script itself.

Here are some maybe useful information :

 Phase: Completed

[ INFO ] DietPi-Update | Current version : v8.20.1
[ INFO ] DietPi-Update | Latest version  : v8.20.1
[  OK  ] DietPi-Survey | Sending survey data
[  OK  ] DietPi-Update | sync
[ SUB1 ] DietPi-Services > restart 
[  OK  ] DietPi-Services | restart : cron

jef@DietPi:~$ uname -a
Linux DietPi 5.15.93-rockchip64 #23.02.2 SMP PREEMPT Fri Feb 17 23:48:36 UTC 2023 aarch64 GNU/Linux

Thanks a lot for your help,

Probably sensor data are stored on a location we don’t expect. I guess something @MichaIng could help with, to find out where it is stored.

Probably the new kernel fixes it already. Could you try that out?

cd /tmp
curl -fO
curl -fO
curl -fO
apt install ./armbian-firmware.deb ./linux-*
rm ./armbian-firmware.deb ./linux-*

Else to check all temperature sources:

for i in /sys/class/thermal/thermal_zone[0-9]/temp /sys/class/hwmon/hwmon[0-9]/temp[0-9]_input /sys/devices/platform/coretemp.[0-9]/hwmon/hwmon[0-9]/temp[0-9]_input
[[ -e $i ]] && echo "$i : $(<$i)"

Thanks a lot, I’ll try as soon as I get home and I’ll let you know :slightly_smiling_face:

Hi again,
Unfortunately, nothing new… well, not quite : I tried to check all temperature sources (using your code) before making any changes, and I had this answer :

/sys/class/thermal/thermal_zone0/temp : 
/sys/class/thermal/thermal_zone1/temp : 

after I applied the changes, the same code gives no answer .
And if I just make a “ls /sys/class/thermal” , I get :

cooling_device0  cooling_device1

uname -a answer :

jef@DietPi:/$ uname -a
Linux DietPi 6.1.46-current-rockchip64 #3 SMP PREEMPT Wed Aug 16 16:27:31 UTC 2023 aarch64 GNU/Linux

and ‘cpu’ command outputs the same answer than before without the 2 first lines (the Invalid argument errors)

Is the correct device tree selected?

cat /proc/device-tree/model

And there is no /sys/class/hwmon at all?
And do those /sys/class/thermal/cooling_device[01] directories contain anything temperature related?

I suppose it is, it says Radxa ROCK Pi 4C+ (actually, the board is a ROCK 4C+ , without the Pi in the name )

There is a /sys/class/hwmon , but nothing in it

No, the /sys/class/thermal/cooling_device0 is a link to /sys/devices/virtual/thermal/cooling_device0 (see image below) - I opened the type file , it contains : cpufreq-cpu0
the same file in /sys/devices/virtual/thermal/cooling_device1 contains : cpufreq-cpu4

Radxa renamed the “ROCK Pi x” series to “ROCK x”, but that does not apply for Linux device trees and boot configurations. They are still named the same to not break any scripts, boot configs etc.

Okay, not sure why, but obviously mainline Linux has no temperature sysfs nodes for the ROCK 4C+ :frowning_face:. Consequently the two empty nodes which caused the two dietpi-globals read errors were removed.

Probably lm-sensors finds some:

apt install lm-sensors

OK, I’ll try that ASAP and post the result here

Thanks again for your help :slightly_smiling_face:

just for information, unfortunately :

Sorry, no sensors were detected.
Either your system has no sensors, or they are not supported, or
they are connected to an I2C or SMBus adapter that is not
supported. If you find out what chips are on your board, check

I’ll investigate again in Radxa and Armbian forums, and I’ll update here if I get some useful information.