Without getting into the specifics of the project, I have a situation where I’m having to electronically add and remove devices from the I2C bus due to addressing concerns. If I can just isolate one line (SDA) instead of both (SDA and SCL) it reduces the complexity and hardware costs.
The scenario (simplified) is I have enough I2C devices that they begin to share addresses. I’m hoping to electronically isolate them into banks and switch between the banks electronically. I was planning on leaving the clock line communicating to all devices, and only worry about switching based on the SDA line.
The question is: does the addressing information travel exclusively over SDA, and thus will isolating just the SDA line be enough to avoid address conflicts?
There are two I2C busses on the RPI. Bus 1 using pins 3 & 5 and Bus 0 using pins 27 & 28. If you are not using a hat with a EEPROM, I believe you can use Bus 0 for additional devices. This may simplify your problem.
The direct answer to your question is that the address is encoded only on the SDA line. The SCL line tells devices when to check the level on SDA, but it carries no other data, including the address data.
But if you let one block of devices see the SCL line alternating while “disconnected” from the SDA bus in some way, those devices will still register the clock signals and read from their SDA pins. What they read will depend on what exactly you did to “disconnect” the SDA bus from that block. Could be high, low, or essentially random depending on what you did. So even though no address information is carried on SCL, you may still have your “disconnected” block of devices responding.
As noted in the comment by Joan, there are external ICs that can be used to change the apparent address of devices on a bus. That may be a better solution for you.
The comments seem to be vandalism at this point. Lest someone come along later and be confused by them, the schematic below illustrates the issue. The OP doesn’t specify how or where he planned to disconnect. If SW2 is closed but SW1 is open, that would disconnect SDA from anything in the box. In that case the pull-up will keep the data pins on anything in the box high, and as the clock alternates, each device will read a high bit. If SW2 is open but SW1 is closed, that would also disconnect SDS from anything in the box. But now the data pins are not pulled-up and may take any state depending a on variety of factors including what’s in the box (e.g. is there another point where the line is pulled-up?), how ideal the switch is, etc.
If there’s confusion, perhaps it’s that both the Pi (the master) and the devices in the box (the slaves) have SDA pins. The master’s pin ultimately needs to be connect to a pull-up for the protocol to work. That’s distinct from what happens on the slaves.