UNOs - Master-Slave and HMC6352 dig compass all three over I2C

I have two UNO boards connected with I2C and the HMC6352 digital compass which also communicates with the master board over I2C. Is this scenario possible?
All three devices are connected to SDA (A4) and SCL (A5). While testing the HMC6352 sketch and having the two boards also connected the program stucks on Wire.endTransmission();

Are the grounds connected? What pull-ups do you use?

Doh! I had each ground separetely on the ground of the circuit I'm using. It works when I'm connecting the grounds together. Do you happen to know why this happens?
Whats the difference of having the grounds separetely from having them connected to each other?
I'm not using any pull-up resistors also. Should I ?

Do you happen to know why this happens?

Without the grounds connected you haven't a common reference where the potentials are measured from. The 5V the Arduino is running on is the voltage compared to ground. If you connect the ground from another device (also running on 5V) to the 5V pin of the Arduino, then you have a voltage of 10V from the Arduinos ground to the 5V of the other device (the voltages adding up).

I'm not using any pull-up resistors also. Should I ?

The Arduino has internal pull-ups for the I2C but they are weak (20k-50k), so with more than 1 device connected or with a bus length of more than 10cm you should add external pull-ups but only one pair per bus (one resistor for the SDA, the other for SCL). The value should be somewhere between 2k2 to 4k7, depending a bit on the buses total capacity and the voltage you're pulling to.

Thank you for the explanation. My wirings are actually a bit longer than 10cm, I have the compass mounted at the other end of the circuit to avoid any magnetic fields.
I'm not quite sure what you mean by 2k2 and 4k7 or how can I measure the buses total capacity though. The compass works with 3.3V, thats the voltage on its SCL and SDA lines.

2k2 means 2.2 kOhm and 4k7 means 4.7 kOhm. The bus capacity is added up from the capacities of the connected devices plus a bit for the bus cables. If you don't have the capacity per meter cable of the wires you use, guess it from a similar cable. Usually it's a few pF per dm. If you have a scope you don't have to calculate the bus capacity, you can simply try different resistor values and have a look at the changes of the signal picture.

In your case I would try with 2k2, this probably fits your needs.

pylon:
2k2 means 2.2 kOhm and 4k7 means 4.7 kOhm. The bus capacity is added up from the capacities of the connected devices plus a bit for the bus cables. If you don't have the capacity per meter cable of the wires you use, guess it from a similar cable. Usually it's a few pF per dm. If you have a scope you don't have to calculate the bus capacity, you can simply try different resistor values and have a look at the changes of the signal picture.

In your case I would try with 2k2, this probably fits your needs.

Thank you. Is this how I should connect the resistors?

Thank you. Is this how I should connect the resistors?

No, the resistors should be pull-ups (pulling up to Vcc) and not pull-downs (pulling to ground). Because your compass module works with 3V3, you should pull the bus to that value. So put a resistor between A4 and 3V3 as well as one between A5 and 3V3.

And you probably want to connect 3V3 to Vcc on the compass module and the GND of it to Arduino's ground.

Right, thats a pull-up. I had no idea.
I just didn't draw the GND and 3.3V to the compass, but I have them connected on the circuit.
Once again, thanks for all the help.

Oops.

EDIT: Should the GND of the compass be connected to Arduino's GND in order to work as a slave device, just like with the slave Arduino? Cause currently I have it on the GND of the circuit.

Should the GND of the compass be connected to Arduino's GND in order to work as a slave device, just like with the slave Arduino? Cause currently I have it on the GND of the circuit.

Sure, the grounds of connected devices have always to be connected, otherwise they have no common reference where signal levels are related to.