ShunjiHashimoto / tang

収穫サポートロボットTANG
2 stars 1 forks source link

シャットダウンボタンを作る #198

Closed ShunjiHashimoto closed 2 years ago

ShunjiHashimoto commented 2 years ago
ubuntu@ubuntu:/boot/firmware$ cat usercfg.txt 
# Place "config.txt" changes (dtparam, dtoverlay, disable_overscan, etc.) in
# this file. Please refer to the README file for a description of the various
# configuration files on the boot partition.
dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up,debounce=100
ubuntu@ubuntu:/boot/firmware$ cat syscfg.txt 
# This file is intended to contain system-made configuration changes. User
# configuration changes should be placed in "usercfg.txt". Please refer to the
# README file for a description of the various configuration files on the boot
# partition.

#dtparam=i2c_arm=on
dtparam=spi=on

include nobtcfg.txt
ubuntu@ubuntu:/boot/firmware$ cat config.txt 
# Please DO NOT modify this file; if you need to modify the boot config, the
# "usercfg.txt" file is the place to include user changes. Please refer to
# the README file for a description of the various configuration files on
# the boot partition.

# The unusual ordering below is deliberate; older firmwares (in particular the
# version initially shipped with bionic) don't understand the conditional
# [sections] below and simply ignore them. The Pi4 doesn't boot at all with
# firmwares this old so it's safe to place at the top. Of the Pi2 and Pi3, the
# Pi3 uboot happens to work happily on the Pi2, so it needs to go at the bottom
# to support old firmwares.

[pi4]
kernel=uboot_rpi_4.bin
max_framebuffers=2

[pi2]
kernel=uboot_rpi_2.bin

[pi3]
kernel=uboot_rpi_3.bin

[all]
arm_64bit=1
device_tree_address=0x03000000

# The following settings are "defaults" expected to be overridden by the
# included configuration. The only reason they are included is, again, to
# support old firmwares which don't understand the "include" command.

enable_uart=1
cmdline=nobtcmd.txt

include syscfg.txt
include usercfg.txt
ShunjiHashimoto commented 2 years ago

参考サイト https://qiita.com/ryo-a/items/2edabbbe2b67654e29c9 https://forums.raspberrypi.com/viewtopic.php?p=2005691#p2005691 https://github.com/raspberrypi/linux/issues/2472#issuecomment-376452021

ShunjiHashimoto commented 2 years ago

やったこと user_config.txtを上記の通りに変更 GPIO3とGNDをタクトスイッチを使ってショートさせた。 i2c_arm=onをコメントアウト このREADMEのgsetting ~を実行 sudo shutodown -h nowを使って再起動後、タクトスイッチを押すことで起動成功、 その後、シャットダウンも成功した。

ShunjiHashimoto commented 2 years ago