There two method to add i2c-dev at the booting time
==========
Method 1:
[root@alarmpi dev]# vim /etc/modules-load.d/raspberrypi.conf
add “i2c-dev” into conf==========
Method 2:
vim /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
[Service]
# is forking instead of oneshot needed here?
Type=oneshot
ExecStart=/etc/rc.local
TimeoutSec=0
#StandardInput=tty
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
vim /etc/rc.local add “modprobe i2c-dev” into rc.local
================================================
Starting ARM’s i2c interface
vim /boot/config.txt
# Uncomment some or all of these to enable the optional hardware interfaces
# Params:
# i2c_arm Set to "on" to enable the ARM's i2c interface
#
# (default "off")
# umcomment the following parameter
device_tree_param=i2c_arm=on
================================================
Install i2c-tools package
pacman -S i2c-tools
[root@alarmpi modules-load.d]# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- 04 -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Reference:
0 意見:
張貼留言