-1

I am trying to get the IMU unit to work on my Nano RP2040.
I get these same results on multiple Arduino Nano RP2040s I installed the python library into the rp2040 using the command ./mpremote.exe mip install github:jposada202020/MicroPython_LSM6DSOX and ran the following code:

import time
from machine import Pin, I2C
from micropython_lsm6dsox import LSM6DSOX
i2c=I2C(0, scl=Pin(13), sda=Pin(12))
print(str(i2c))
devices = i2c.scan()
print(str(devices))
if devices:
    for d in devices:
        print(hex(d))
        time.sleep(1)
time.sleep(1)
lsm = LSM6DSOX(i2c)
while (True):
    print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.accel()))
    print('Gyroscope:     x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.gyro()))
    print("")
    time.sleep_ms(100)

When I am not connected to anything, I get

I2C(0, freq=399361, scl=13, sda=12, timeout=50000)
[106]
0x6a
106 15 1 #this is coming from a debug line I wrote to print 'obj._address, self.register, self.lenght' in the 'RegisterStruct' class of i2c_helpers.py 
Traceback (most recent call last):
  File "<stdin>", line 13, in <module>
  File "/lib/micropython_lsm6dsox/lsm6dsox.py", line 159, in __init__
  File "/lib/micropython_lsm6dsox/i2c_helpers.py", line 120, in __get__
OSError: [Errno 5] EIO

and when I am using the analog pins, I get:

I2C(0, freq=399361, scl=13, sda=12, timeout=50000)
[]
106 15 1
Traceback (most recent call last):
  File "<stdin>", line 13, in <module>
  File "/lib/micropython_lsm6dsox/lsm6dsox.py", line 159, in __init__
  File "/lib/micropython_lsm6dsox/i2c_helpers.py", line 120, in __get__
OSError: [Errno 5] EIO

Any help would be much appreciated!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.