bivab / smbus-cffi

Python bindings for Linux SMBus access through i2c-dev using cffi
GNU General Public License v2.0
61 stars 31 forks source link

IOError 121 when using on Intel Edison #12

Open PranshuBansalDev opened 8 years ago

PranshuBansalDev commented 8 years ago

Hey there,

I'm getting the following error when trying to use the code for Intel Edison (LSM9DS0)

Traceback (most recent call last): File "berryIMU.py", line 126, in writeACC(CTRL_REG1_XM, 0b01100111) #z,y,x axis enabled, continuos update, 100Hz data rate File "berryIMU.py", line 38, in writeACC bus.write_byte_data(ACC_ADDRESS , register, value) File "/usr/lib/python2.7/site-packages/smbus/util.py", line 59, in validator return fn(_args, *_kwdefaults) File "/usr/lib/python2.7/site-packages/smbus/smbus.py", line 145, in write_byte_data raise IOError(ffi.errno) IOError: 121

Any idea what's going on?

macvenez commented 7 years ago

Hi, I am getting the same error on an Intel Edison with mpu9250 connected to I2C-6 If I run i2cget command i can get the data correctly but when I try to run this program in python it gives me this error:

_Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/FaBo9Axis_MPU9250/MPU9250.py", line 286, in mpu9250 = MPU9250() File "/usr/lib/python2.7/site-packages/FaBo9Axis_MPU9250/MPU9250.py", line 104, in init self.configAK8963(AK8963_MODE_C8HZ, AK8963_BIT_16) File "/usr/lib/python2.7/site-packages/FaBo9Axis_MPU9250/MPU9250.py", line 170, in configAK8963 bus.write_byte_data(AK8963_SLAVE_ADDRESS, AK8963_CNTL1, 0x00) File "/usr/lib/python2.7/site-packages/smbus/util.py", line 59, in validator return fn(*args, **kwdefaults) File "/usr/lib/python2.7/site-packages/smbus/smbus.py", line 145, in write_bytedata raise IOError(ffi.errno) IOError: 121

I double checked the libraries and the circuit (I'm using an IMU10DOF by Grove connected to an Edison Arduino Breakout Board) but I don't know where could be the problem

Thank you

PranshuBansalDev commented 7 years ago

It'd be easier to write your own driver using MRAA instead of smbus

https://iotdk.intel.com/docs/master/mraa/edison.html

macvenez commented 7 years ago

Thank you for the fast answer. I was just thinking about doing that, I tried with the temperature conversion and it wasn't really easy. Do you have a mpu9250 working with Edison? Are there any working libraries for this module on Edison? Thank you

PranshuBansalDev commented 7 years ago

No idea at all about the mpu9250,

Depending on your budget, I'd reccommend looking into this tutorial I wrote at UCLA:

https://drive.google.com/drive/folders/0B4NGslzPqDhvYkgxeVpKVEpYNUk

iot.seas.ucla.edu

The parts we used are here

https://www.sparkfun.com/products/13033 https://www.sparkfun.com/products/13045 https://www.sparkfun.com/products/13037 https://www.sparkfun.com/products/13187

Total value ~$100

macvenez commented 7 years ago

Thank you for the help. I just noticed that your IMU9DOF by Sparkfun is different from mine (mine it's from Grove) and it isn't mpu9250 based. I wanted to use my sensor instead of buying a new one. Thanks anyway for your documentation. I think I'm going to write my own library for the mpu. Thanks a lot