# MP9250 9-axis sensor using I2C stops working after sometime

**URL:** <https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092>\
**Category:** mangOH Red\
**Created:** [November 12, 2018, 3:37am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092 "2018-11-12T03:37:27Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 12, 2018, 3:37am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/1 "2018-11-12T03:37:27Z")

</div>

```
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](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********************
```

---

<div class="post-metadata">

**Author:** ![shib](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shib](https://mangoh.discourse.group/u/shib)\
**Post date:** [November 12, 2018, 4:11am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/2 "2018-11-12T04:11:10Z")

</div>

What does the scope show when you are receiving NACKs? Does everything (MOSI/MISO/SCK/CS) look ok?

---

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 12, 2018, 5:52am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/3 "2018-11-12T05:52:39Z")

</div>

I am using I2C Not SPI,  
Regarding Scope: I ran scope during NACK time, i see blank, no data no clk.

---

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [November 12, 2018, 1:06pm UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/4 "2018-11-12T13:06:47Z")

</div>

> [@epsragh](#):
>
> same code works on STM32 board and same sensor

SO, on your scope/analyser, have you compared the two?

Have you managed to capture the point at which the mangOH “stop working” ?

---

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 13, 2018, 2:21am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/5 "2018-11-13T02:21:00Z")

</div>

```
Thanks for the reply,

I know the place where it stops, In mangoh It stops at during SelfTest ; which requires around 200 + 200 read of GYRO and ACCEL regs data for self test completion.

This is the place where it fails (after around 20 iterations which is just reading 6 registers no thing else.) or starts getting NACK i.e in scope i see nothing but blank,No clk and no data.
I also introduced some delays like 100ms but no use.

Is I2C mux stopped working ? . I do not know how to proceed further any help or pointers are much appreciated.
```

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [November 13, 2018, 6:09am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/6 "2018-11-13T06:09:07Z")

</div>

Hey @epsragh,

Would it be possible to see the output from `dmesg | grep i2c`? We faced issues regarding the i2c data line getting stuck low (see [GPIO stops working after several hours](https://mangoh.discourse.group/t/gpio-stops-working-after-several-hours/1273/24?u=nick)) resulting in a “bus busy” error from the Qualcomm i2c driver in the kernel log. We never really found a conclusive answer either. In general, cutting down on i2c traffic seemed to do the trick (i.e no polling).

Also, which module are you using? We’ve been testing with a WP85 on release 15 firmware and a fork of Legato 18.04.0. I have yet to test release 16 of the WP85 firmware but I’m optimistic that it could improve i2c performance.

---

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 13, 2018, 8:26am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/7 "2018-11-13T08:26:11Z")

</div>

```
Thanks for the reply,
dmesg
****************************************************
[100.980139] 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
[108.031943] 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
[118.047108] 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
[128.056173] 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
[138.071834] 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
[148.083726] 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
[158.092871] 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
[193.284306] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
*****************************************************
cm info---------------------

Device: WP7608
IMEI: 352913090103092
IMEISV: 4
FSN: XG814285190310
Firmware Version: SWI9X07Y_02.16.02.00 000000 jenkins 2018/04/19 19:59:02
Bootloader Version: SWI9X07Y_02.16.02.00 000000 jenkins 2018/04/19 19:59:02
MCU Version: 002.007
PRI Part Number (PN): 9907762
PRI Revision: 001.002 
Carrier PRI Name: GENERIC
Carrier PRI Revision: 002.032_000
SKU: 1103788
Last Reset Cause: Power Down
Resets Count: Expected: 127	Unexpected: 3
root@swi-mdm9x28:~# app info mpu9250 
mpu9250
  status: stopped
  app.name: mpu9250
  app.md5: 2409f44378009037c4c676ad7c882caf
  app.version: 1.0
  legato.version: 18.07.0

------------------------------------------------------------------
I am getting this Error within 10s of operation start.
   One thing I observed , When ever the NACK comes, if I re-enable the I2C bus, it works fine, probably it is resetting ( I am not able to calibrate)the I2C sensor.
void Re_EnableI2cBus
(
void
)
{
uint8_t data;
if(i2cdev_fd > 0){
  close(i2cdev_fd); 
}
LE_DEBUG("Re Enabling TCA9546A I2C switch...");
const int i2cBus = 4;
i2cdev_fd = I2cAccessBusAddr(i2cBus, 0x71);
LE_FATAL_IF(i2cdev_fd == LE_FAULT, "failed to open i2cbus %d", i2cBus);
const uint8_t enableAllPorts = 0xff;
LE_FATAL_IF(i2c_smbus_write_byte(i2cdev_fd, enableAllPorts) == -1, "failed to write i2c data");
 // Read WHO_AM_I register for MPU-9250
LE_DEBUG("!!!!!!!!!!!WHO_AM_I 0x%x\n",SmbusReadReg(0x4, 0x69,0x75,&data));
}

```

please let me know anything that i can try to resolve this .

---

<div class="post-metadata">

**Author:** ![awneil](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/awneil/32/486_2.png) [@awneil](https://mangoh.discourse.group/u/awneil)\
**Post date:** [November 13, 2018, 11:50am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/8 "2018-11-13T11:50:25Z")

</div>

Why do you keep formatting your posts as code?  
It makes them hard to read - as they don’t wrap to the window.

> [@epsragh](#):
>
> I know the place where it stops

So how does that compare to your STM32 case?

> [@epsragh](#):
>
> This is the place where it fails (after around 20 iterations

So zoom in on that - what, exactly, is happening? How does it compare to the STM32 case?

> [@epsragh](#):
>
> I do not know how to proceed further

Have you looked at the mangOH schematics for places to probe?

> [@epsragh](#):
>
> around 200 + 200 read of GYRO and ACCEL regs

So lots of I2C traffic, then.

> [@nick](#):
>
> cutting down on i2c traffic seemed to do the trick

sounds like a thing to try …

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [November 13, 2018, 6:47pm UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/9 "2018-11-13T18:47:05Z")

</div>

Hey all,

Unfortunately I don’t think this is the same behaviour or errors we saw. I’ll be sure to keep an eye on this post and share anything I may find.

Best of luck!

---

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 14, 2018, 2:12am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/10 "2018-11-14T02:12:39Z")

</div>

STM32 keeps working It never stops or give any Error,  
In mangoH board , as I said all of a sudden no clk and no data(when NACK msg starts)

---

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 14, 2018, 2:14am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/11 "2018-11-14T02:14:15Z")

</div>

> [@awneil](#):
>
> So zoom in on that - what, exactly, is happening? How does it compare to the STM32 case?

STM works perfectly fine same code , always I see clk and data line but not in MangoH board.

---

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 14, 2018, 2:17am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/12 "2018-11-14T02:17:58Z")

</div>

> [@awneil](#):
>
> cutting

I am getting NACK for around 20 r/w operations . what else can I do.

---

<div class="post-metadata">

**Author:** ![epsragh](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@epsragh](https://mangoh.discourse.group/u/epsragh)\
**Post date:** [November 14, 2018, 2:19am UTC](https://mangoh.discourse.group/t/mp9250-9-axis-sensor-using-i2c-stops-working-after-sometime/2092/13 "2018-11-14T02:19:05Z")

</div>

> [@awneil](#):
>
> Have you looked at the mangOH schematics for places to probe?

I will look into it.
