I have a question related to I2C.
Actually I have connected 2 arduinos (One as Master and the another one as Slave), both are connected with the corresponding PINS: SCL and SDA.
o.
The problem is:
actually when I upload the programs to each Arduino, I only receive the adress, but the data is missing in Master and in Slave too. I attached the screenshot "Missing info" where is the answer.
and before I could see them but now it doesn't appear anymore.
I tried to re-upload the code but the signal answer always is the same
Please let me know if it's more a trouble with my programm or something more. or if you know some tip that could help me.
I attached the code if you need to review it for Master and Slave
You must not call any interrupt-dependent code (p.e. methods of the Serial object) inside interrupt context! Both Wire event callbacks are called in interrupt context. Your code may lead to a freeze.
Remove that line, it's contra-productive.
You should print out the return values of Wire.endTransmission() and Wire.requestFrom() on the master. That shows if the transfer was successful.
Something is wrong with the scope image, but I don't understand what I see in the picture.
The data from the Master is there, but the data from the Slave seems a little like it, but many bits are missing.
Which Arduino boards do you use ?
The most important wire of the I2C bus is the GND wire. Did you connect the GNDs ?
Do you have pullup resistors ?
How long are the wires ? What kind of wires do you use ? (SDA next to SCL in a flat ribbon cable is the worst).
Does the scope misinterpret the signals ? I think it does.
If you want to test the I2C bus, then you should not use the "RP" inputs. Just send a number of bytes, and let it run for while and check if it runs for hours without any error. The I2C bus is not fault tolerant, it should work 100% all the time.
Master (Arduino Giga), Slave (Arduino UNO)
Yeah, in fact I have GNDs connected in common for both Arduinos.
Yes, I have Pull ups since it helped me to have the signals in rectangle form and less peaks when I review Oscilloscope.
The wires are not long, they are short to avoid to have noises during communication. They are not flat ribbon, I'm using a cable that is able to insert in the pins for SCL and SDA, I don't know how explained.}
It shouldn't misinterpret signal, please tell me how can I review that?
RP inputs? I don't understand what it means, what is that? tell me please.
I see no GND wire between the boards. Do they have a common GND somewhere far away where the USB cables are plugged into a computer ? That is not good enough.
Can you show a screendump of a single byte that goes wrong ? That are 9 CLK pulses with a missing ACK on the 9th pulse.
The Arduino Giga has a STM32 processor at 3.3V.
The Arduino Uno has a AVR microcontroller at 5V. According to its datasheet, it needs at least 3.5V at SDA and SCL to see it as a high level. So officially it can not work within the specifications of the datasheet. In real life it works, but there is no noise margin left.
You could fix it with a I2C level shifter.
What is your project about ? If you need more digital or analog pins, then there are better solutions.
[ADDED]
Do you know if a Giga board as Master via a I2C level shifter to a Uno as Slave will work at all ? This is the I2C bus. You can use it with sensors. For anything else you could be in the dark.
If you don't explicitly tell otherwise we always expect you to use UNO boards!
The Giga and UNO boards use different voltages. You need level converters to adapt the two voltages. Theoretically you can get that running if the pullups are to 3.3V but don't expect such a setup to work reliably.
Hello team, I reviewed and I decided to change the Arduinos for two new ones (Arduino Mega (Master) and Arduino UNO (Slave)) and the communication was successful by using the same programm.
I disconnect and tried to connect the originals but the answer never changed. it's posible that the arduinos received high voltage or current and it was not posible to get the communication again.