Jetson Xavier Nx i2c connection problem with any sensor such as mpu6050

Hello everyone. I have jetson Xavier Nx and Mpu 6050 Imu sensor. There are a library and a tutorial for this sensor but library working on jetson nano . jetson nano bus 1 using scl 5.pin and sda 3.pin . But jetson xavier Nx bus 1 using scl 28.pin and sda 27.pin so any sensor can’t working on jetson Xavier NX Please help me how can i fix it. PLease Please Please …


tutorial is here

Did you confirm the i2cdetect on Xavier NX?

I tried 4.6.4 Jetpack. All of my sensors work now on the Xavier Nx (MPU6050, 7-inch LCD monitor). My Jetpack version was 5.1.1 when I had this problem. There are many incompatible problems with the latest Jetpack version. You have to fix it. Please report these problems. I tried maybe 2-3 mounts for this problem.

Please confirm if i2cdetect able to detect the device then breakdown to .py file to narrow down it.

My jetson Xavier NX detects the MPU6050 sensor on Jetpack 5.1.1, as you can see in the first photo. and connected with 27/28 pins as different from the Jetson Nano because Xavier Nx bus 1 uses 27/28 pins, as you know.
The same code is not working on the 5.1.1 jetpack but works on 4.6.4 and also my 7’’ monitor is not work on 5.1.1 jetpack.
I have tried to fix this problem on three mounts. How can i know about related Jetpack versions?

import smbus            #import SMBus module of I2C
from time import sleep          #import
 
#some MPU6050 Registers and their Address
PWR_MGMT_1   = 0x6B
SMPLRT_DIV   = 0x19
CONFIG       = 0x1A
GYRO_CONFIG  = 0x1B
INT_ENABLE   = 0x38
ACCEL_XOUT_H = 0x3B
ACCEL_YOUT_H = 0x3D
ACCEL_ZOUT_H = 0x3F
GYRO_XOUT_H  = 0x43
GYRO_YOUT_H  = 0x45
GYRO_ZOUT_H  = 0x47
 
 
def MPU_Init():
    #write to sample rate register
    bus.write_byte_data(Device_Address, SMPLRT_DIV, 7)
     
    #Write to power management register
    bus.write_byte_data(Device_Address, PWR_MGMT_1, 1)
     
    #Write to Configuration register
    bus.write_byte_data(Device_Address, CONFIG, 0)
     
    #Write to Gyro configuration register
    bus.write_byte_data(Device_Address, GYRO_CONFIG, 24)
     
    #Write to interrupt enable register
    bus.write_byte_data(Device_Address, INT_ENABLE, 1)
 
def read_raw_data(addr):
    #Accelero and Gyro value are 16-bit
        high = bus.read_byte_data(Device_Address, addr)
        low = bus.read_byte_data(Device_Address, addr+1)
     
        #concatenate higher and lower value
        value = ((high << 8) | low)
         
        #to get signed value from mpu6050
        if(value > 32768):
                value = value - 65536
        return value
 
 
bus = smbus.SMBus(1)    # or bus = smbus.SMBus(0) for older version boards
Device_Address = 0x68   # MPU6050 device address
 
MPU_Init()
 
print (" Reading Data of Gyroscope and Accelerometer")
 
while True:
     
    #Read Accelerometer raw value
    acc_x = read_raw_data(ACCEL_XOUT_H)
    acc_y = read_raw_data(ACCEL_YOUT_H)
    acc_z = read_raw_data(ACCEL_ZOUT_H)
     
    #Read Gyroscope raw value
    gyro_x = read_raw_data(GYRO_XOUT_H)
    gyro_y = read_raw_data(GYRO_YOUT_H)
    gyro_z = read_raw_data(GYRO_ZOUT_H)
     
    #Full scale range +/- 250 degree/C as per sensitivity scale factor
    Ax = acc_x/16384.0
    Ay = acc_y/16384.0
    Az = acc_z/16384.0
     
    Gx = gyro_x/131.0
    Gy = gyro_y/131.0
    Gz = gyro_z/131.0
     
 
    print ("Gx=%.2f" %Gx, u'\u00b0'+ "/s", "\tGy=%.2f" %Gy, u'\u00b0'+ "/s", "\tGz=%.2f" %Gz, u'\u00b0'+ "/s", "\tAx=%.2f g" %Ax, "\tAy=%.2f g" %Ay, "\tAz=%.2f g" %Az)     
    sleep(1)

From the error looks like unable read/write data by i2c python code.
Have confirm if i2cget/i2cwrite able to access the mpu6050

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.