Reading CPU temperature on Beaglebone Black
Asked Answered
K

2

7

I have a Beaglebone Black running Ubuntu 14.04. I flashed it using a guide to flashing a pre-built image to eMMC.

From the guides I've seen, I should be able to read /sys/class/hwmon/hwmon0/device/temp1_input to get the CPU temperature. But, I have no such path on my system; I'm guessing a kernel module for the Beaglebone Black's AM3358 ARM CPU provides this functionality and that my image lacks such a module, but I don't know where to start to get such a module. In fact, /sys/class/hwmon is an empty directory.

These are the modules that I do have:

$ lsmod | sort
6lowpan_iphc           10154  1 bluetooth
bluetooth             316797  10 bnep,rfcomm
bnep                   11946  2
can_dev                 7430  1 c_can
c_can                   9400  1 c_can_platform
c_can_platform          5927  0
g_multi                 3238  0
iptable_filter          1149  1
ip_tables              11857  1 iptable_filter
libcomposite           38715  5 usb_f_acm,usb_f_ecm,usb_f_rndis,g_multi,usb_f_mass_storage
musb_am335x             1075  0
musb_dsps               8369  0
musb_hdrc              76236  1 musb_dsps
rfcomm                 46571  0
rfkill                 14659  2 bluetooth
u_ether                 9524  3 usb_f_ecm,usb_f_rndis,g_multi
usb_f_acm               5687  1
usb_f_ecm               7901  1
usb_f_mass_storage     34664  2 g_multi
usb_f_rndis            17711  2 g_multi
u_serial                9631  1 usb_f_acm
x_tables               12575  3 ip_tables,xt_multiport,iptable_filter
xt_multiport            2051  1

...and overall status:

$ uname -a
Linux hostname 3.14.26-ti-r43 #1 SMP PREEMPT Wed Dec 24 05:27:12 UTC 2014 armv7l armv7l armv7l GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:        14.04
Codename:       trusty

So, how can I read the CPU temperature on a Beaglebone Black that is missing this file?

Kinesiology answered 22/1, 2015 at 22:28 Comment(0)
C
5

I've done my bit of searching the interwebs and have come up empty handed.

What I have found sofar is that the current Debian (I'm using Linux bbone 4.1.12-ti-r29 #1 SMP PREEMPT Mon Nov 9 22:46:19 UTC 2015 armv7l GNU/Linux) and probably all derivatives of it AND probably also recent predecessors of it (at least as far back as your kernel 3.14.26) no longer populate /sys/class/hwmon.

Also lm-sensors doesn't find any sensors on the board, whatsoever, so that's a dead-end aswell.

And what I gather from TI, is that the temperature sensor was never really meant to be used by the end-user. TI even prescribes a method of measuring the board temperature via an external sensor (see here).

So, that's a bummer, but there you have it.

EDIT: I've also found that Debian 8.2 shows the behaviour I described here, however, today I flashed Debian 7.9 (from here; Linux bbone 3.8.13-bone79 #1 SMP Tue Oct 13 20:44:55 UTC 2015 armv7l GNU/Linux) and that comes with a fully populated /sys including /sys/class/hwmon/hwmon0/device/temp1_input which is a temperature reading in millidegreesC. Mind you, this is probably a relative temperature that shouldn't be relied upon (acc. TI).

Captain answered 29/11, 2015 at 11:12 Comment(2)
Hi from 2021 and debian 10 with hwmon still empty. Have you by change figured out how debian 7.9 populates /sys/class/hwmon?Pettifog
@Pettifog I've given up on Beaglebone some time ago and am focussing on Raspberry Pi now.Captain
M
0

I haven't tested it on ubuntu 14.04 but here's my 2-cents on this matter. There's tmon, a very simple tool that reads the temperature while running another process, just like time, watch, timeout, etc... tmon is a thin wrapper around /sys/class/thermal/thermal_zone*/temp, and can be useful when monitoring the temperature of your Linux computer/server while running CPU intensive processes: simulation, gaming, etc...

You can download the .AppImage "binary" from here: https://github.com/gmagno/tmon/releases and run it immediately and conveniently, that is:

Install

wget https://github.com/gmagno/tmon/releases/download/v0.3.7/tmon-a461481-x86_64.AppImage
chmod +x tmon*.AppImage
# optional: you may put it somewhere convenient in your file system and add a symlink in /usr/local/bin/tmon

or if you prefer:

pip install tmonpy

Usage

./tmon*.AppImage -h

Examples

./tmon*.AppImage echo "Quick programs return a single value of temperature"
Quick programs return a single value of temperature


===================
Temp Monitor Report:

   Temp (°C) for a period of 0:00:00
   >> 58.0 °C <<

   /tmp/[email protected]
===================
./tmon*.AppImage bash -c 'echo not so quick ones will show a chart; sleep 6'
not so quick ones will show a chart


===================
Temp Monitor Report:

   Temp (°C) for a period of 0:00:06
   60.00  ┤
   59.86  ┤
   59.71  ┤
   59.57  ┤
   59.43  ┤
   59.29  ┤
   59.14  ┤
   59.00  ┼╮   ╭─
   58.86  ┤│   │
   58.71  ┤│   │
   58.57  ┤│   │
   58.43  ┤│   │
   58.29  ┤│   │
   58.14  ┤│   │
   58.00  ┤╰───╯

   >> min: 58.0 °C <<
   >> avg: 58.4 °C <<
   >> max: 59.0 °C <<

   /tmp/[email protected]
===================

you may also just run tmon without any arguments and it will run as you'd expect. Press Ctrl-C to terminate the process and get a temperature report

./tmon*.AppImage  # and wait a few seconds before pressing Ctrl-C
^C

===================
Temp Monitor Report:

   Temp (°C) for a period of 0:00:08
   60.00  ┤
   59.71  ┤
   59.43  ┤
   59.14  ┤
   58.86  ┤  ╭╮
   58.57  ┤  ││
   58.29  ┤  ││
   58.00  ┼╮╭╯│
   57.71  ┤││ │
   57.43  ┤││ │
   57.14  ┤││ │
   56.86  ┤╰╯ │
   56.57  ┤   │
   56.29  ┤   │
   56.00  ┤   ╰────

   >> min: 56.0 °C <<
   >> avg: 56.9 °C <<
   >> max: 59.0 °C <<

   /tmp/[email protected]
===================
Mortality answered 8/2, 2020 at 0:5 Comment(1)
on my beaglebone black /sys/class/thermal/ is an empty directory. What OS / image are you using on the beaglebone black that it's populated?Watermelon

© 2022 - 2024 — McMap. All rights reserved.