LoginSignup
0
1

More than 5 years have passed since last update.

link > Raspberry Pi > I2C > Sr (Repeated Start Condition)が必要なセンサーを読むための設定

Last updated at Posted at 2019-01-29
Raspberry Pi 2 Model B (以下RPi)
Raspbian Jessie
Python 2.7.9
Geany 1.24.1
GNU Make 4.0
gcc (Raspbian 4.9.2-10) 4.9.2
とあるI2Cセンサー

Sr (Repeated Start Condition)が必要

とあるI2Cセンサーとの通信をSMBusで試していた。
I2Cの仕様書によると、メモリアドレスの後にSr(Repeated Start Condition)が必要とのこと。

Srを発行できるには?

資料

情報感謝です。

/etc/modprobe.d/i2c.confにおいて下記を記載する (こちらの環境では新規ファイル)

options i2c_bcm2708 combined=1

その後、以下を実行してみました。

$ sudo modprobe -r i2c-bcm2708
$ sudo modprobe i2c-bcm2708 baudrate=400000

次に、読込み用のPythonプログラムを実行したところ、センサーから数値が読めました。

疑問と対処

疑問点:
combined=1の設定により、おかしくなる状況はあるのかどうか?

未調査。

ソフトウェアI2Cを実装する予定なので、動作確認後はi2c.confを消しておきました (*1)

*1) 元々なかったファイルのため

時間が取れた時に影響の(資料)調査をするかもしれません。

動作確認

Analog Discovery 2において動作確認。

  • Samples: 5M
  • Rate: 500kHz
  • I2Cの通信: 400kHz

関連

実は教えていただいていました

2017年3月7日に、@fujiwarasoftservice さんにコメントにてリンク先を教えていただいていました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1