I2C works with Uno, not with FeatherM0

Thread Starter

Julian Rogers

Joined Oct 12, 2016
2
Hi

I have a number of I2C slaves, half are in one unit and half in another each of which connect to an Adafruit Feather M0 by a 5m screened cable (so two cables - I know that's rather long for I2C!) There is no address contention as far as I am aware. With either unit connected, by themselves, on the Feather, data flows with no trouble. With both connected, the sketch (program) runs correctly on the Feather, data arrives as expected but only for about (it varies slightly) ten cycles of the main program loop. Then the Feather crashes and needs a power-off reset to revive it. It feels like a buffer runs out of space. However, if I substitute an Arduino Uno for the Feather, everything works fine, indefinitely! Can anyone say why this should be?
Many thanks!
Julian
 

Ian Rogers

Joined Dec 12, 2012
1,136
Probably running far too fast... I would look at the speed that is coming out of the SCK.. I bet it's max a lot quicker than the Arduino's max.
 

Raymond Genovese

Joined Mar 5, 2016
1,653
From a pure divide and conquer pov, I would suggest that you shorten the cables and re-run and see if you get stable communication.

What about about the pull-ups on the two boards. The UNO is a 5V and the Feather is a 3V what values are using for each? Can you scope the signals to verify visually what the signal looks like? - take a look here https://gammon.com.au/forum/?id=10896 (under Pull Ups section) to see how the I2C signals can be affected by pull-up resistor values.

A quick search showed a couple of other interesting aspects....
Upgrade to latest IDE and Adafruit SAMD boards - https://forums.adafruit.com/viewtopic.php?f=25&t=127525

Timing problem with I2C frequencies Feather - https://github.com/adafruit/Adafruit_Arduino_Boards/issues/14

Let us know how you solve it please.
 

Thread Starter

Julian Rogers

Joined Oct 12, 2016
2
Hi, thanks for your replies!

Many thanks for pointing me in the direction of the pull ups! Now I feel rather stupid! When I looked again at the pcb I made for the Feather and other bits and bobs, I noticed I had made provision for pull ups but I could see from the solder residue, I had put them in and taken them out and not replaced them. I think I was going to change the value. (Doh!) So the effective pull ups were the 10k resistors in the level converters at the remote end of 5m of cable (the slave units run at 5 volts). It worked for one length of cable but a second length scuppered it. When I hooked in the Uno instead of the Feather, I included a level converter to shift back up to 5 volts thus introducing 10k pull ups which presumably allowed it to work. Anyway, with 5.6k pull ups, the Feather now works with both slave units.

I enclose traces showing the working I2C with the 10m of screened cable compared with 1m of cable. Looking at that, it is a bit of a wonder that the I2C works at all!

Thanks once again for pointing me in the right direction. As someone new to this forum, I much appreciate such a rapid and well-informed response to my problem!

Best wishes,

Julianbadi2c2.jpg
 
Top