Raspberry Pi i2c read / write error

Like many people, I had a Pi for a while, but I never did anything with it. I finally turned around to connect the MPU6050 IMU to play. It uses i2c for communication, so I followed the Adafruit guide regarding the possibility of including i2c here Adafruit i2c .

Then I connected the MPU6050 to the i2c bus, and using i2cdetect -y 1, I was able to see the device at 0x68.

However, when I tried to read or write from the device, I got a permission error, so I went after this message to solve the / dev / i2c-x permission problem . He told me to change /lib/udev/rules.d/60-i2c-tools.rules with

KERNEL=="i2c-0"     , GROUP="i2c", MODE="0660"
KERNEL=="i2c-[1-9]*", GROUP="i2c", MODE="0666"

This worked, but then when you try to read or write using C ++, I get an “I / O Error”. Similarly, using smbus in Python, I get [Errno 5] Input/output error When connected to Arduino, I can get this device to work fine.

I have exhausted every forum I can find. Hope I just did something stupid. Does anyone have any ideas?

The original B RPi model launches Raspbian, if any help.

Greetings

+4
source share

Source: https://habr.com/ru/post/1650461/


All Articles