I've a question regarding the RaspberryPi 3 Model B.
In the installation I'm working on, I need to connect 8 of them and I must do this using the I2C protocol.
I'm using the I2C port 0 actually (pin 27 and 28, called ID_SD and ID_SC respectively) since I cannot use the other one.
I've tried to read as much documentation as I could about the topic and I know that these pins are not meant to be used this way:
Nevertheless it (almost) seems to work and now I have the PIs acting as masters, pulling information from a single Arduino UNO board, which is their slave (poor guy )!
My question is about the pullup resistors.
I know that the I2C bus drivers are “open drain”, so I must take care for the signal to return high when not in use.
The problem here is that Arduino and the PIs are operating at two different voltages (isn't it?).
As suggested by the same tutorial, in cases like this I can use the "trick" of putting the pullups on the lower voltage device (the RaspberryPi in my case).
The question is:
1. Do these (I2C 0) RaspberryPi pins already have their own internal pullup resistors? Just in case, can these resistors be enabled/disabled?
On the Arduino side, I know pins A4 (SDA) and A5 (SCL) already have their own internal pullups, or at least that's what I can say after reading the source code of the Wire library I'm using for the Arduino code.
See the begin and the end functions (inside the Wire.cpp file) which in turns call the twi_init() and twi_disable() functions (see utility/twi.c file).
Here the interested lines of code for twi_init():
Code: Select all
// activate internal pullups for twi. digitalWrite(SDA, 1); digitalWrite(SCL, 1);
Code: Select all
// deactivate internal pullups for twi. digitalWrite(SDA, 0); digitalWrite(SCL, 0);
If I will explicitly disabled the Arduino internal pullups via code (using the digitalWrite(SDA, 0) and digitalWrite(SCL, 0)), is this hardware configuration going to work (pullpus to 3.3V the Arduino side)?
I'm mean, I've already tried it and it works but I'm not perfectly sure it is the right way to approach the problem. I don't know if I'm damaging my I2C Pi pins and consequently I don't know if this configuration will be sufficiently robust to last for hours/days/months;
The second question which naturally came out is:
2. Am I damaging my pins? Are these pins protected in some way? Do I risk to permanently damage them, maybe with some incorrect voltage on the I2C bus? ( I hope not but actually I think I've already damaged one of my pi using external pullups to 5V the Arduino side).
Sorry for my wall of text. I will highly appreciate any support!
Thank you so much and again