I have searched for my problem on the internet, got quite some interesting results but none quite the same.
I have a project, in which I need to use two MPU9250 units in 2 different locations.
I have programmed everything, tested it on breadboards, it went fine. When I made the real cable for it (about 50cm), things started to fall apart. The cable is an 8-wire shielded cable. The wires include 3v3, 5v, and the rest are signals (pwm, encoder, etc). One IMU is near the Arduino (due), and the other is at the far side of the cable.
The funny thing is, that when the cable is disconnected, the closer unit works fine. But when I connect it, not only the far unit doesn't respond, but the close unit as well.
- I have already read about the capacitance and length of cables.
To make things short - I have narrowed it down to the GND shielding as being the problem. When I remove the GND it all works fine. So my questions are:
- Is this normal? Isn't it generally a good idea to shield cables from noises? Would this also affect a 30Khz PWM signal in the same manner?
- Can anyone tell from experience if I am to encounter additional problems, having other signals running together on the same multi-wire cable?
- Would it be better to run the I2C wires outside of the cable or give up the shielding and take the GND out?
Thanks in advance,
could you be getting a ground loop?
is it OK if you only connect the shield at one end?
Thats the funny part. The cable internal wires are connected to SDA, SCL, 3v3, 5v etc. on one side, but to nothing on the other. Its just a 50cm extension of the circuit, going towards nothing at the other end. If that cable has the GND shortened to its shielding, the i2c gets scrambled, but if it is disconnected then everything is fine.
I have checked for short-circuits, but there are none.
Isn't that weird?
if you have an oscilloscope look at the SDA & SCL signals when you connect the ground - what happens?
I2C is sensitive to cable capacitance and connecting the ground may be effecting it
what pull-up resistors do you have on the SDA and SCL lines? try lowering the resistor values, e.g. to 2.2Kohm
That would be a great idea, unfortunately I do not own an oscilloscope.
I use the native Arduino Due i2c pins. Putting a resistor in parallel to theirs was to be my next trial, but changing the cable to a 10-wires shielded cable, without grounding the shield (but just using it as a wire inside) did the trick. If I run into any more problems, I shall retry putting a resistor as well.
Thank you Horace.
I have successfully used i2c signals over unshielded cat5e cable for more than 10m with no problems.
Never tried shielded untwisted cabling.