Reputation:
I have a RaspberryPi3 connected to an Adafruit MPL3115A2 over the I2C bus. I have the latest version of Raspbian Jessie downloaded today. The only thing I have done is run
sudo rasp-config
to enable the i2c bus then reboot and install the i2ctools using
sudo apt-get install -y i2c-tools
When I run
i2cdetect -y 1
I see the device on address 0x60 where I expect it to be.
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
However, when I try to read the WHO_AM_I register using
i2cget -y 1 0x60 0x0C b
or
i2cget -y 1 0x60 0x0C c
I get 0x00 when I am expecting 0xC4. running the above with ```sudo`` makes no difference.
If I shutdown Raspbian, pull the sdcard, insert an sdcard with Windows IoT Core and boot. I have no problem reading 0xC4 from the WHO_AM_I register as expected. Consequently, I am reasonably certain this is not bad hardware.
I've scoured the web looking for help (trust me I'm not allowed to post any more links to prove it). I've tried several suggested edits to /boot/config.sys including disabling the device tree and setting the baud rate to match what we are seeing from Windows IoT Core (400kHz, Raspbian appeared to have a default around 64kHz)using a Saleae Logic Analyzer (can't give you a link, google it). The only difference we can see is that Raspbian appears to have a discrete change from writing to reading that the logic analyzer can detect whereas we are not seeing that on IoT Core. We are stuck, any help or ideas would be great.
Edit:I'd add a tag for raspbian-jessie but alas I am not reputable enough
Just verified on a RaspberryPi2 with the same version of jessie (a new img on a fresh sdcard) and the failure is the same so it seems like Raspbian Jessie is the smoking gun here.
Upvotes: 3
Views: 1392
Reputation:
We came across the answer buried in a post on using the sensor with python. Turns out the MPL3115A2 requires repeated start transactions which are disabled by default on Raspbian. The solution is to add the following line to the end of your /etc/rc.local
file just before the exit 0
echo -n 1 > /sys/module/i2c_bcm2708/parameters/combined
Upvotes: 0