Hardware Status Monitoring?
#1
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.
  Reply
#2
(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
  Reply
#3
(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...
  Reply
#4
(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.
  Reply
#5
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;
}
  Reply
#6
(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
  Reply
#7
Photo 
[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


Attached Files
.jpg   monitor.JPG (Size: 215.73 KB / Downloads: 618)
  Reply
#8
(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
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  The state of mainline hardware decoding CounterPillow 17 18,046 01-26-2022, 03:39 PM
Last Post: sigmaris
  Hardware acceleration using FFmpeg gusarg81 0 3,097 08-21-2020, 01:36 PM
Last Post: gusarg81
  hardware-accelerated video transcoding (Plex) on Rock64 mdr 2 8,078 02-07-2019, 03:42 PM
Last Post: mdr
  How to do hardware decoding of video? SuperSaiyanCaleb 9 17,347 08-28-2018, 01:39 PM
Last Post: mcerveny
  H264 hardware encoder not work sueshieh 3 7,150 11-02-2017, 03:57 AM
Last Post: dalmate
  What is name of gpio hardware on a rock64? gene83 6 7,416 10-05-2017, 07:57 AM
Last Post: gene83
  4.4 and Mainline Status Matrices Luke 0 2,678 08-17-2017, 02:32 AM
Last Post: Luke

Forum Jump:


Users browsing this thread: 2 Guest(s)