goo blog サービス終了のお知らせ 

pepoとネットワークを語ろう

40年前からこれまでとこれからのネットワークを語る

お盆休み1日しかないのにraspberry pi zero wのi2cが動かんで潰れてしまったわ( ゚Д゚)

2018-08-13 21:28:39 | Linux

AM2320を接続して
root@iot001:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
検出、出来なかったけど
root@iot001:~# rmmod i2c_bcm2835
root@iot001:~# modprobe i2c_bcm2835
と何故かモジュールを入れなおすとOKになる
oot@iot001:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@iot001:~# pepoam2320
24.8 63.7
温度・湿度が正常に取得できたわ


raspberry pi zero w i2c does not work. However, if you reload the i2c_bcm2835 module, it works

2018-08-13 21:13:18 | Linux

root@iot001:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@iot001:~# lsmod
Module                  Size  Used by
fuse                   92214  3
cmac                    3230  1
rfcomm                 37969  6
bnep                   11981  2
hci_uart               26546  1
btbcm                   8248  1 hci_uart
serdev                  9370  1 hci_uart
bluetooth             366847  29 hci_uart,bnep,btbcm,rfcomm
ecdh_generic           17649  1 bluetooth
spidev                  7220  0
brcmfmac              273198  0
brcmutil                9114  1 brcmfmac
snd_bcm2835            22991  1
cfg80211              542242  1 brcmfmac
snd_pcm                89590  1 snd_bcm2835
rfkill                 21476  6 bluetooth,cfg80211
snd_timer              22396  1 snd_pcm
snd                    60154  5 snd_timer,snd_bcm2835,snd_pcm
i2c_bcm2835             6465  0
spi_bcm2835             7456  0
w1_gpio                 4566  0
wire                   31600  1 w1_gpio
cn                      5687  1 wire
hwmon                  10505  1 wire
uio_pdrv_genirq         3718  0
fixed                   3033  0
uio                     9901  1 uio_pdrv_genirq
i2c_dev                 6674  0
ip_tables              12427  0
x_tables               22098  1 ip_tables
ipv6                  402036  24
root@iot001:~# rmmod i2c_bcm2835
root@iot001:~# modprobe i2c_bcm2835
root@iot001:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@iot001:~# pepoam2320
24.8 63.7