Hi I am using mangoh Red board RPI connector I2C interface to interface MPU9250-9axis sensor.
I am able to
1) detect the I2C slave
2) Read(single and multi byte also)/Write Registers.
Problem facing.
after around 100 operations(read//write) I am facing NACKs from slave.
same code works on STM32 board and same sensor.
I ported code from: https://github.com/kriswiner/MPU9250/blob/master/AK8963_as_slave/AK8963Slave0_MPU9250_Ladybug.ino
can some one please help/guide me.
***************************I2C log***********************
Nov 12 03:12:24 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp _mpu9250Component_COMPONENT_INIT() 97 | =============== I2C Reading & Writing application has started
Nov 12 03:12:24 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c EnableI2cBus() 223 | Enabling TCA9546A I2C switch...
Nov 12 03:12:24 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x75, data=0x71
Nov 12 03:12:24 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp _mpu9250Component_COMPONENT_INIT() 104 | I AM 0x71 ^M
Nov 12 03:12:24 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp _mpu9250Component_COMPONENT_INIT() 105 | I SHOULD BE 0x71 ^M
Nov 12 03:12:24 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp _mpu9250Component_COMPONENT_INIT() 111 | MPU9250 WHO_AM_I is 0x71 ^M
Nov 12 03:12:24 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp _mpu9250Component_COMPONENT_INIT() 112 | MPU9250 is online... ^M
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusWriteReg() 202 | SMBUS Write addr 0x69, reg=0x6b, data=0x80
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusWriteReg() 202 | SMBUS Write addr 0x69, reg=0x19, data=0x0
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusWriteReg() 202 | SMBUS Write addr 0x69, reg=0x1a, data=0x2
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusWriteReg() 202 | SMBUS Write addr 0x69, reg=0x1b, data=0x1
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusWriteReg() 202 | SMBUS Write addr 0x69, reg=0x1d, data=0x2
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusWriteReg() 202 | SMBUS Write addr 0x69, reg=0x1c, data=0x1
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3b, data=0xe4
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3c, data=0xa5
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3d, data=0xfd
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3e, data=0x8f
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3f, data=0x37
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x40, data=0xd2
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x43, data=0xfe
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x44, data=0xc6
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x45, data=0xff
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x46, data=0x5a
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x47, data=0x0
Nov 12 03:12:25 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x48, data=0x4a
Nov 12 03:12:25 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp MPU9250SelfTest() 632 | ACCEL_XOUT_H,GYRO_XOUT_H,i0
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3b, data=0xe4
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3c, data=0x19
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3d, data=0xfd
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3e, data=0xa4
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3f, data=0x37
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x40, data=0x8f
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x43, data=0xfe
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x44, data=0x92
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x45, data=0xfe
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x46, data=0xd6
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x47, data=0xfc
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x48, data=0x6a
Nov 12 03:12:26 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp MPU9250SelfTest() 632 | ACCEL_XOUT_H,GYRO_XOUT_H,i1
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3b, data=0xe4
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3c, data=0x8b
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3d, data=0xfd
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3e, data=0xa9
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x3f, data=0x37
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x40, data=0x9b
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x43, data=0xfd
Nov 12 03:12:26 swi-mdm9x28 user.debug Legato: DBUG | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 159 | SMBUS READ bus=0x4 addr=0x69, reg=0x44, data=0x72
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 428.869106] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x45
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 428.896811] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x46
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 428.924352] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x47
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 428.952656] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x48
Nov 12 03:12:26 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp MPU9250SelfTest() 632 | ACCEL_XOUT_H,GYRO_XOUT_H,i2
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 429.082340] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x3b
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 429.109580] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x3c
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 429.137766] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x3d
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 429.165339] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x3e
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 429.192616] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x3f
Nov 12 03:12:26 swi-mdm9x28 user.err kernel: [ 429.219881] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:26 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x40
Nov 12 03:12:27 swi-mdm9x28 user.err kernel: [ 429.348530] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:27 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x43
Nov 12 03:12:27 swi-mdm9x28 user.err kernel: [ 429.376978] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:27 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x44
Nov 12 03:12:27 swi-mdm9x28 user.err kernel: [ 429.405248] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:27 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x45
Nov 12 03:12:27 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x46
Nov 12 03:12:27 swi-mdm9x28 user.err kernel: [ 429.435297] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x011363c8 OPER:0x00000010
Nov 12 03:12:27 swi-mdm9x28 user.err kernel: [ 429.461684] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:27 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x47
Nov 12 03:12:27 swi-mdm9x28 user.err kernel: [ 429.489108] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:27 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x48
Nov 12 03:12:27 swi-mdm9x28 user.info Legato: INFO | mpu9250[2708]/mpu9250Component T=main | main.cpp MPU9250SelfTest() 632 | ACCEL_XOUT_H,GYRO_XOUT_H,i3
Nov 12 03:12:27 swi-mdm9x28 user.err kernel: [ 429.621421] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x69 MSTR_STS:0x0d1300c8 OPER:0x00000010
Nov 12 03:12:27 swi-mdm9x28 user.err Legato: =ERR= | mpu9250[2708]/mpu9250Component T=main | util.c SmbusReadReg() 153 | smbus read failed with error -1 Reg:0x3b
****************************END I2C log********************