Wow. Thanks for all the answers. You are awsome!
Are the pins on the PIC properly configured for I2C?
I think so. Used MPLAB Code Configurator (nice, simple GUI) for that. Since it works with the probes attached, the configuration should be fine. Attached some pictures of the configuration.
could you post some scope shots showing the traffic? maybe somedetail rising/falling edges. maybe try using slower speed for a test.
I tried 400kHz and 100 khz speed. I will post a scope picture shortly.
I think I would have put the pull-up resistors at the far end of the bus relative to the uC.
I'm not an electronics engineer. Can you explain to me why this might be better? Is it just good practice or absolutely vital?
Likely not a source of the problem but thermal pad of MCP9808 must be connected to GND according to the datasheet (may be according to other part of the datasheet ).
Yes, I noticed when I got the PCB's made. Forgot to do it. Stupid me.
I will keep that in mind for the next revision. However, the datasheet says
"There is an internal electrical connection between the Exposed Thermal Pad (EP) and the GND pin. The EP may be connected to the system ground on the Printed Circuit Board (PCB).". So it's not a must. As I understood it, its only to reduce the effects caused by self heating.
Keep in mind that the probe represents a small capacitive load. So, you may try to put a 20pF cap to GND on both traces (without the probe) and see see what happens...
Yes, but typically the I²C-Bus doesn't require adding capacitance. There is even a maximum of 400pF.
May also be, that what is affecting the operation is not necessarily probe capacitance but the fact you are connecting GND of the PCB to the mains earth through the scope.
There is an extra USB-port on the board. I used it as a serial interface to get a temperature reading. So it should be connected to mains earth through the computer, right (used a desktop PC)?
Read this http://ww1.microchip.com/downloads/en/DeviceDoc/70000195f.pdf
This doc suggest 2K2 pull-up and you should test:
bit 9 DISSLW: Disable Slew Rate Control bit
1 = Slew rate control is disabled
0 = Slew rate control is enabled
Johan-Fredrik
Good idea, tried it with a 100khz speed, with DISSLW enabled and disabled. No change. Doesn't work. The doc doesn't say anything about 2.2k. It just gives you some rough formulas. In fact, I²C should work with anything between 2.2k and 4.7k.
When I first tested the project, the I²C-Bus didn't work.
I would suspect a bus collision on I2C start , how you configuring the I2C pins.?
There's only one device on the bus. So there shouldn't be any collisions. The bus is configured as shown in the screenshots attached.
... that is not even near anything "high-speed" where such effects would matter.
A 400kHz clock on a high speed input double clocks just as easily as a 400MHz clock.
I would agree to that when we would be talking about push-pull outputs, but this is open-drain with pull-up. Capacitances do matter here, even at such low speed.
Yes, but shouldn't the circuit fail rather than work by adding capacitance through the scope? I will post a scope image shortly.