- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello,
I am trying to use I2C6 on the Edison Breakout Board via Python and mraa, but I haven't had any luck in doing so, even though everything works fine on I2C1.
I used a BME280 for the following tests:
- Device plugged on I2C1:
- i2cdetect (i2cdetect -r 1) detects the device at 0x76
- the Python script below displays '96' for the WhoAmI, as expected
# !/usr/bin/env python
import mraa as m
if __name__ == "__main__":
bme = m.I2c(0)
bme.address(0x76)
print("BME WhoAmI: %s" %bme.readReg(0xD0))
- Device plugged on I2C6:
- i2cdetect (i2cdetect -r 6) correctly detects the device at 0x76 (while on other posts related to I2C6 on this forum, the device was not even detected)
- However the exact same Python script as above doesn't work anymore, displaying '0' as WhoAmI
- setting 'bme = m.I2c(1)' instead of 'bme = m.I2c(0)' doesn't work either
- setting 'bme = m.I2c(1)' instead of 'bme = m.I2c(0)' doesn't work either
I am using the Yocto image '20160315'. Similar outcomes were observed on other I2C devices.
Do I need to change something in the Python script? Or configure something in Linux?
Thank you for your help!
Armel
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
When using the command bme = m.I2c(0) you're actually using i2c6, not i2c1. Do you need to connect several i2C devices? If that's the case then the approach to follow is by assigning a different address to each I2C device
You can see more information related to the I2C buses and addresses here
/message/360174# 360174 https://communities.intel.com/message/360174# 360174
/message/344099# 344099 https://communities.intel.com/message/344099# 344099
Sergio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Sergio,
Thanks for the hints.
The key was to specify the right bus number in the line 'bme = m.I2c(X)' below are my findings:
- when the device(s) are plugged into I2C1: any X in [0,8] will work, except 6
- when the device(s) are plugged into I2C6: X must be 6
Best,
Armel

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page