Raspbian 資料一覧

Raspberry Pi 3の動作状況とハードウェア設定を取得する(vcgencmd)

2016/11/05更新

対応バージョン: Raspbian Jessie Lite - September 2016

vcgencmdコマンドを使うとCPUの温度や動作電圧などRaspberry Piの動作状況を調べることができる。

また通常のPCにおけるUEFI(BIOS)で指定する各種設定もvcgencmdコマンドで取得できる(Raspberry PiにはUEFI(BIOS)の機構がないので/boot/config.txtで指定する)。

以下、代表的な使用例を記す。

Raspberry Piの動作状況

ファームウェアのバージョン
% vcgencmd version
Sep 21 2016 13:13:29
Copyright (c) 2012 Broadcom
version 2eaf52cc53435b5ce67253af1487f9a4f9f96e2d (clean) (release)
CPUの温度
% vcgencmd measure_temp
temp=48.9'C
CPUの動作周波数
% vcgencmd measure_clock arm
frequency(45)=600000000
CPUの動作電圧
% vcgencmd measure_volts
volt=1.2000V
メモリ割当

Raspberry Pi 3 Model Bは1GBメモリをCPU(arm)とGPUで共用

% vcgencmd get_mem arm
arm=944M

% vcgencmd get_mem gpu
gpu=64M
フレームバッファ情報(height, width, depth)
% vcgencmd get_lcd_info
640 480 24

その他、利用可能なサブコマンドはvcgencmd commandsで確認できる。情報取得だけでなく設定のサブコマンドもあるので注意して使用すること。

% vcgencmd commands
commands="vcos, ap_output_control, ap_output_post_processing,
vchi_test_init, vchi_test_exit, pm_set_policy, pm_get_status,
pm_show_stats, pm_start_logging, pm_stop_logging, version,
commands, set_vll_dir, set_backlight, set_logging, get_lcd_info,
arbiter, cache_flush, otp_dump, test_result, codec_enabled,
get_camera, get_mem, measure_clock, measure_volts, scaling_kernel,
scaling_sharpness, get_hvs_asserts, get_throttled, measure_temp,
get_config, hdmi_ntsc_freqs, hdmi_adjust_clock, hdmi_status_show,
hvs_update_fields, pwm_speedup, force_audio, hdmi_stream_channels,
hdmi_channel_map, display_power, read_ring_osc, memtest,
dispmanx_list, get_rsts, schmoo, render_bar, disk_notify,
inuse_notify, sus_suspend, sus_status, sus_is_enabled,
sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom,
mem_reloc_stats, hdmi_cvt, hdmi_timings, file, vctest_memmap,
vctest_start, vctest_stop, vctest_set, vctest_get"

/boot/config.txtで指定する設定

OS起動時にconfig.txtで指定する設定はvcgencmdコマンドのget_configカテゴリに続けてパラメータの種類を指定することで取得できる。

vcgencmd get_config [config|int|str]

configに実際のパラメータを指定するとその設定の値が表示される。例えばarm_freqを指定するとCPU(arm)のクロックが1.2GHzであることが分かる。

% vcgencmd get_config arm_freq
arm_freq=1200

intあるいはstrを指定すると整数(int)あるいは文字列(str)で設定されている設定値が一覧で表示される(設定済のもののみ表示)。

% vcgencmd get_config int
arm_freq=1200
audio_pwm_mode=1
config_hdmi_boost=5
core_freq=250
desired_osc_freq=0x36ee80
disable_commandline_tags=2
disable_l2cache=1
enable_uart=1
force_eeprom_read=1
force_pwm_open=1
framebuffer_ignore_alpha=1
framebuffer_swap=1
gpu_freq=300
hdmi_force_cec_address=65535
hdmi_force_hotplug=1
init_uart_clock=0x2dc6c00
lcd_framerate=60
mask_gpu_interrupt1=0x10000
over_voltage_avs=0x10c8e
pause_burst_frames=1
program_serial_random=1
sdram_freq=450
temp_limit=85

% vcgencmd get_config str
device_tree=-

config.txtで指定可能なパラメータは公式ドキュメント(英語)を参照のこと。

関連資料・記事

参考サイト