Go Down

Topic: I2C issue  (Read 399 times) previous topic - next topic

kock

Hi,

Again an issue with UNO WIFI Rev2. My test hardware includes two sensors, one magnetometer LSM 303
 and one telemeter Sharp gp2y0e02b, both use I2C for communication with Arduino UNO or Arduino Wifi Rev2.

My test script is uploaded into Arduinos.

- if only one sensor is connected, all is ok with UNO and Wifi Rev2
- when both sensors are connected to UNO, all is correct, two expected values are printed,
- when both sensors are connected to UNO Wifi Rev2, only heading value is correct. Distance value is always 0, meaning Sharp sensor time out .

Any idea ? thanks for your help.

Dan



kenharpster

#1
Mar 23, 2019, 09:46 pm Last Edit: Mar 24, 2019, 01:35 am by kenharpster Reason: Adding attachment for I2C_Scanner sketch
Have you tried running the I2C_Scanner sketch to confirm that the two device's addresses show up and are what your sketch/library uses on the WiFi Rev2. I have two devices connected to I2C on my WiFi Rev2 (I2C LCD2004, BMP280) and have no issues getting data to/from either. So perhaps confirming the WiFi Rev2 can see your two devices will help to determine where the problem lies. I am of course assuming you're using the SDA and SCL pins on the WiFi Rev2 and not the A4 and A5 pins since you have one I2C device that works.



sevenoutpinball

where are the i2c pins on the rev2?
Flash is fast, Flash is cool.

kenharpster

They're the 1st 2 pins on the "DIGITAL header" next to the USB port:  SCL (clock), and SDA (data).

kock

Hi,

I solved my issue after many hours working with a scope. With UNO or UNO WiFi R3, SDA and SCL are a bus reserved for external devices. With Rev2, SDA and SCL are also used for internal exchanges between NINA ESP and MEGA4809.

In my use case, external devices are located at about 20 cm from Arduino UNO WiFi Rev2, in a little bit noisy environment (noise produced by a 12 volts motor).

So, the noise received by wires between external devices and Rev2 reaches the heart of the solution. Internal exchanges are corrupted. Furthermore, the level shifters distort SDA, SCL signals.

In previous UNO WiFi, links between ESP and AT328 were protected by a dedicated links. In a NodeMCU, two SPI Link are used, one for communication with a onboard memory and one for communication with external devices.

So, i think Arduino UNO Wifi REV is poorly designed. I'm still waiting for sketch OTA :-(

Dan

kock

i use screened wire.

kenharpster

I am curious, how far from the Arduino board is the 12 volt motor? And, is the shielding on your wires grounded?

kock

My previous email is ambiguons. Now i use a grounded shielding and data exchanges are good. With previous UNO WiFi board, in my usecase, a shielding is not required.

goodchip76

#8
Apr 11, 2019, 11:41 am Last Edit: Apr 11, 2019, 11:46 am by goodchip76
Maybe your problem here is different, but there were some youth issues with the Wire.h library for this architecture : https://github.com/arduino/ArduinoCore-megaavr/issues/26

The new bluild shares these problems (mainly problems found when using the arduino as a i2c master which does not seem to be your case here).

Otherwise, clearly yes, the Uno WiFi rev2 card to a very badly routed PCB (i2c and serial lines, by example ...).

Go Up