TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: =?UTF-8?Q?BJ=C3=B6RN_LUND
date: 2017-11-04 20:25:00
subject: Cannot read values from P

Hi!
I got a GY-521 (or MPU-6050) for reading movement.
I connect it to pin 1,3,5,6 (vcc, SDA, SCL, Ground) as most tutorials
suggest.
I have enabled I2C
I find the device with

pi@raspberrypi:~ $ sudo 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: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I can read the device id
pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x75
0x68

but I get 0x00 for the x/y/z and ax/ay/az values whatever I do
pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x44
0x00
pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x43
0x00
pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x3b
0x00
pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x3c
0x00


using
https://raw.githubusercontent.com/Tijndagamer/mpu6050/master/mpu6050/mpu6050.py
I get
pi@raspberrypi:~ $ sudo python mpu6050.py
36.53
Traceback (most recent call last):
   File "gyro_test.py", line 247, in 
     accel_data = mpu.get_accel_data()
   File "gyro_test.py", line 139, in get_accel_data
     x = self.read_i2c_word(self.ACCEL_XOUT0)
   File "gyro_test.py", line 71, in read_i2c_word
     high = self.bus.read_byte_data(self.address, register)
IOError: [Errno 121] Remote I/O error

So it reads temp, but get 0 back (get_temp adds 36.53)
and crashes on reading ACCEL_XOUT0 which is 0x3B.
Which was read to 0 by i2cget, unless that handles read error of course.



pi@raspberrypi:~ $ cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

i2c-dev
i2c-bcm2708


pi@raspberrypi:~ $ grep blacklist /etc/modprobe.d/*
/etc/modprobe.d/blacklist-rtl8192cu.conf:blacklist rtl8192cu
/etc/modprobe.d/blacklist-rtl8xxxu.conf:blacklist rtl8xxxu
/etc/modprobe.d/fbdev-blacklist.conf:# This file blacklists most
old-style PCI framebuffer drivers.
/etc/modprobe.d/fbdev-blacklist.conf:blacklist arkfb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist aty128fb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist atyfb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist radeonfb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist cirrusfb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist cyber2000fb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist kyrofb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist matroxfb_base
/etc/modprobe.d/fbdev-blacklist.conf:blacklist mb862xxfb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist neofb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist pm2fb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist pm3fb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist s3fb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist savagefb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist sisfb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist tdfxfb
/etc/modprobe.d/fbdev-blacklist.conf:blacklist tridentfbonme
/etc/modprobe.d/fbdev-blacklist.conf:blacklist vt8623fb



pi@raspberrypi:~ $ grep i2 /boot/config.txt
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=i2c1=on



pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.35+ #1014 Fri Jun 30 14:34:49 BST 2017 armv6l
GNU/Linux



The above is from a pi Zero, I get the same result with a Pi 1b+
Anyone have any suggetions


--
--
Björn

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.