Hello.
I currently try to rebuild my project and i want to use interrupt from my MPU6050 (gy521). So I enable it with this code:
somefunction(){
attachInterrupt(0, MPUiter, RISING);
Wire.beginTransmission(MPU_addr);
Wire.write(0x37); // INT_PIN_CFG
Wire.write(0B00000000); //
Wire.endTransmission(false);
Wire.beginTransmission(MPU_addr);
Wire.write(0x38); // INT_ENABLE
Wire.write(0B00000001); //
Wire.endTransmission(false);
}
void MPUiter(){
MpuBufCnt++;
}
but after few seconds code hang. I try pushpull mode and open drain with same resoult.
While i unsolder INT wire from gyro side then arduino does not hang (i spend ~3 hours to get that) but when I unplug only for arduino side then it still hang. So my question is what may be wrong with my circuit?
My MPU is connected with arduino using twisted ~1m 5x0,14mm2 (see pictures).
I also have some trouble with I2C because rarely arduino hang while communicating with MPU and Im not sure what pullup resistor i should use and one side or both side. Currently i have 1k (and oryginal 4k7) resistor on MPU side but it still sometime stuck. Unfortunately I do not have osciloscope so I do know it it even help.
Sorry for double post. I accidently press post before I write all post.