Hi VP,
Yes you can do it, but it will not be pretty. How pretty it isn't will depend on the devices involved.
There are a number of classes your devices might fall into:
- Devices that can run on either 5v or 3.3v
- 3.3v devices that can tolerate 5v inputs (rare)
- 5v devices that can accept 3.3v inputs (TTL compatible)
- 3.3v devices that only accept 3.3v levels, and
- 5v devices that require 5v levels.
If you can avoid the following, you should try. By using parts that fit into the first three classes, you could avoid the following ugliness.
I will discuss combining the last two, as that is the ugliest situation. First, the bus needs to be separated into a 3.3v segment and a 5v segment. The two segments are connected with resistors (I used 470 ohm), and each segment has its own pull-up resistors (2k typically) to their respected voltages. Then add clamping diodes to the 3.3v segment to prevent it from being driven over 3.3v by the 5v segment. If speed is not an issue, the pull-ups on the 3.3v segment can be eliminated and the 3.3v segment is then pulled-up by the 5v segment. But you then may want to lower the resistance of the segment-connection resistors, as they will limit the rise-time of the 3.3v segment. This will, of course, increase the current that is wasted through the connection resistors and the clamping diodes.
So, in effect, instead of two resistors for pull-ups, you have either four or six resistors and two diodes. Remember that the connection resistors and the clamping diodes will be dissipating 1.67 volts continuously, so size them accordingly.