PINE64
Hardware Status Monitoring? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=85)
+--- Forum: Linux on Rock64 (https://forum.pine64.org/forumdisplay.php?fid=88)
+--- Thread: Hardware Status Monitoring? (/showthread.php?tid=5874)



Hardware Status Monitoring? - Leapo - 03-20-2018

Is it possible to measure hardware status (core temperature, core voltage, core clock, memory voltage, memory clock, etc.) on the Rock64 under Linux? So far, I've managed to read core temperature and clockspeed, but that's about it.

I know vcgencmd works on the Raspberry Pi, and was ported to the Pine64, but I haven't seen anything similar for the Rock64.


RE: Hardware Status Monitoring? - evilbunny - 03-20-2018

(03-20-2018, 12:48 PM)Leapo Wrote: Is it possible to measure hardware status (core temperature, core voltage, core clock, memory voltage, memory clock, etc.) on the Rock64 under Linux? So far, I've managed to read core temperature and clockspeed, but that's about it.

I know vcgencmd works on the Raspberry Pi, and was ported to the Pine64, but I haven't seen anything similar for the Rock64.

Do you know about this script?

/usr/local/sbin/rock64_diagnostics.sh


RE: Hardware Status Monitoring? - pfeerick - 03-21-2018

(03-20-2018, 12:48 PM)Leapo Wrote: Is it possible to measure hardware status (core temperature, core voltage, core clock, memory voltage, memory clock, etc.) on the Rock64 under Linux? So far, I've managed to read core temperature and clockspeed, but that's about it.

I know vcgencmd works on the Raspberry Pi, and was ported to the Pine64, but I haven't seen anything similar for the Rock64.

Readily available is the cpu temperature and cpu frequency - as reported by rock64_health.sh or rock64_diagnostics.sh

You can get the voltage (in microvolts) of the cpu here : /sys/class/regulator/regulator.7/microvolts

It used to be regulator.4, but it seems that is now for one of the USB ports.

Code:
eval cat /sys/class/regulator/regulator.{0..12}/name
regulator-dummy
vcc_phy
vcc_sys
vcc_sd
vcc_host_5v
vcc_host1_5v
vdd_logic
vdd_arm
vcc_ddr
vcc_io
vdd_18
vcc18_emmc
vdd_10

A lazy test of
Code:
eval cat /sys/class/regulator/regulator.{0..12}/microvolts
tells us that regulators 2,3,6,7,9,10,11 & 12 are the only ones reporting any voltages. So it looks like you can get the voltage of the SD card, eMMC, and CPU. regulator.8 which looks like it may be memory related doesn't seem to report any voltage info.

Code:
#!/bin/bash

REGULATOR_PATH="/sys/class/regulator/"

for regulator in `ls $REGULATOR_PATH | sort -V`; do
   echo $regulator, $(cat $REGULATOR_PATH/$regulator/name), $(cat $REGULATOR_PATH/$regulator/microvolts 2>/dev/null )
done

yields

regulator.0, regulator-dummy,
regulator.1, vcc_phy,
regulator.2, vcc_sys, 5000000
regulator.3, vcc_sd, 3300000
regulator.4, vcc_host_5v,
regulator.5, vcc_host1_5v,
regulator.6, vdd_logic, 1050000
regulator.7, vdd_arm, 1100000
regulator.8, vcc_ddr,
regulator.9, vcc_io, 3300000
regulator.10, vdd_18, 1800000
regulator.11, vcc18_emmc, 1800000
regulator.12, vdd_10, 1000000

I'm not sure what the other regulators are controlling... you might be able to work backwards from the names through the schematic to see what they are hooked up to... assuming the names are right...


RE: Hardware Status Monitoring? - Leapo - 03-21-2018

(03-20-2018, 09:35 PM)evilbunny Wrote: Do you know about this script?

/usr/local/sbin/rock64_diagnostics.sh

Hadn't seen that before, but it uses the same method I'd already figured-out to get CPU clockspeed and CPU Temperature. Doesn't appear to pull any of the other stats I'm after, though.

(03-21-2018, 05:28 AM)pfeerick Wrote: You can get the voltage (in microvolts) of the cpu here : /sys/class/regulator/regulator.7/microvolts

That was incredibly helpful, and got me on the right track, thank you!

Quick reference of the monitoring points I've discovered so-far:
CPU Temp: /sys/class/thermal/thermal_zone0/temp
CPU Volts: /sys/class/regulator/regulator.5/microvolts
CPU Freq: /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
GPU Freq: /sys/devices/platform/ff300000.gpu/devfreq/ff300000.gpu/cur_freq
SYS Volts: /sys/class/regulator/regulator.3/microvolts

For clarification, "SYS Volts" appears to be the 5v input that the Rock64 runs from (Handy for making sure your power supply is up to scratch). And you're right, it looks like the buck converter handling the memory isn't reporting voltage. That's kinda concerning... From the specs, it should be running at 1.2 or 1.25v for DDR3LP, but getting the real voltage would be nice.


RE: Hardware Status Monitoring? - NicoD - 03-31-2018

I wrote this C program to monitor the CPU temp. Just put it in Geany or another C compiler, save it as a *.c file, I call it tempCheck.c
Then compile it and run it.
Code starts after this.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void sleep_ms(int milliseconds)
{
struct timespec ts;
ts.tv_sec = milliseconds / 1000;
ts.tv_nsec = (milliseconds % 1000) * 1000000;
nanosleep(&ts, NULL);

}

int main()
{
int nanosleep(const struct timespec * req, struct timespec * rem);
FILE *temperature;
double T;
while(1)
{
temperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r");

if(temperature == NULL)
{
printf("Can't measure the cpu temperature");
}
else
{
fscanf(temperature, "%lf", &T);
T /= 1000;
system("clear");
printf("The cpu temperature is %6.3f C.\n", T);
fclose(temperature);
sleep_ms(500);
}
}return 0;
}


RE: Hardware Status Monitoring? - PopcornMaker - 06-25-2019

(03-31-2018, 06:30 PM)NicoD Wrote: I wrote this C program to monitor the CPU temp. Just put it in Geany or another C compiler, save it as a *.c file, I call it tempCheck.c
Then compile it and run it.
Code starts after this.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void sleep_ms(int milliseconds)
{
struct timespec ts;
ts.tv_sec = milliseconds / 1000;
ts.tv_nsec = (milliseconds % 1000) * 1000000;
nanosleep(&ts, NULL);

}

int main()
{
int nanosleep(const struct timespec * req, struct timespec * rem);
FILE *temperature;
double T;
while(1)
{
temperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r");

if(temperature == NULL)
{
printf("Can't measure the cpu temperature");
}
else
{
fscanf(temperature, "%lf", &T);
T /= 1000;
system("clear");
printf("The cpu temperature is %6.3f C.\n", T);
fclose(temperature);
sleep_ms(500);
}
}return 0;
}
Thank you ! Smile


RE: Hardware Status Monitoring? - default_user8 - 06-30-2019

[attachment=1374][attachment=1374]
(03-20-2018, 12:48 PM)Leapo Wrote: Is it possible to measure hardware status (core temperature, core voltage, core clock, memory voltage, memory clock, etc.) on the Rock64 under Linux? So far, I've managed to read core temperature and clockspeed, but that's about it.

I know vcgencmd works on the Raspberry Pi, and was ported to the Pine64, but I haven't seen anything similar for the Rock64.


Is this sufficient for your needs?
https://forum.pine64.org/showthread.php?tid=4462



RE: Hardware Status Monitoring? - bendem - 03-15-2020

(03-31-2018, 06:30 PM)NicoD Wrote: I wrote this C program to monitor the CPU temp. Just put it in Geany or another C compiler, save it as a *.c file, I call it tempCheck.c
Then compile it and run it.
Code starts after this.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void sleep_ms(int milliseconds)
{
struct timespec ts;
ts.tv_sec = milliseconds / 1000;
ts.tv_nsec = (milliseconds % 1000) * 1000000;
nanosleep(&ts, NULL);

}

int main()
{
int nanosleep(const struct timespec * req, struct timespec * rem);
FILE *temperature;
double T;
while(1)
{
temperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r");

if(temperature == NULL)
{
printf("Can't measure the cpu temperature");
}
else
{
fscanf(temperature, "%lf", &T);
T /= 1000;
system("clear");
printf("The cpu temperature is %6.3f C.\n", T);
fclose(temperature);
sleep_ms(500);
}
}return 0;
}

For those that don't want to compile a program, this can be done in two lines of bash ;-) :


Code:
temp=$(cat /sys/class/thermal/thermal_zone0/temp)
echo ${temp::-3}.${temp:(-3)} C