adafruit / adafruit/Adafruit_CircuitPython_BNO055
I2C I/O Error on Teensy 4.1
- Dominant language
- Python
- Stars
- 94
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
While testing the Adafruit BNO055 sensor connected using STEMMA QT to a Teensy 4.1 with IMXRT1062DVJ6A running Adafruit CircuitPython 8.2.3 on 2023-08-11, I encountered the following error which seems to be an issue with I2C protocol.
```
code.py output:
Temperature: 0 degrees C
Accelerometer (m/s^2): (0.0, 0.0, 0.0)
Magnetometer (microteslas): (10.0625, 13.75, -39.375)
Gyroscope (rad/sec): (-0.00109083, 0.00218166, -0.00218166)
Euler angle: (0.0, 0.0, 0.0)
Quaternion: (0.0, 0.0, 0.0, 0.0)
Linear acceleration (m/s^2): (0.0, 0.0, 0.0)
Gravity (m/s^2): (0.0, 0.0, 0.0)
Temperature: 28 degrees C
Traceback (most recent call last):
File "code.py", line 291, in
File "adafruit_bno055.py", line 416, in acceleration
File "adafruit_bno055.py", line 155, in __get__
File "adafruit_register/i2c_struct.py", line 49, in __get__
OSError: [Errno 5] Input/output error
```
Code sample used:
```
import adafruit_bno055
import busio
# Initialize the IMU imu_sensor
imu_i2c = busio.I2C(board.SCL, board.SDA)
imu_sensor = adafruit_bno055.BNO055_I2C(imu_i2c)
last_val = 0xFFFF
def temperature():
global last_val # pylint: disable=global-statement
result = imu_sensor.temperature
if abs(result - last_val) == 128:
result = imu_sensor.temperature
if abs(result - last_val) == 128:
return 0b00111111 & result
last_val = result
return result
while True:
print("Temperature: {} degrees C".format(imu_sensor.temperature))
"""
print(
"Temperature: {} degrees C".format(temperature())
) # Uncomment if using a Raspberry Pi
"""
print("Accelerometer (m/s^2): {}".format(imu_sensor.acceleration))
print("Magnetometer (microteslas): {}".format(imu_sensor.magnetic))
print("Gyroscope (rad/sec): {}".format(imu_sensor.gyro))
print("Euler angle: {}".format(imu_sensor.euler))
print("Quaternion: {}".format(imu_sensor.quaternion))
print("Linear acceleration (m/s^2): {}".format(imu_sensor.linear_acceleration))
print("Gravity (m/s^2): {}".format(imu_sensor.gravity))
print()
time.sleep(1)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported BNO055 I2C failure on the Teensy 4.1 using the supplied code and CircuitPython 8.2.3. Trace the failing read from adafruit_bno055.py lines 416 and 155 through adafruit_register/i2c_struct.py line 49. Done means the reported sensor properties can be read without the OSError, with the behavior documented or covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100