Without seeing your code, just guessing....
I'm wondering if your program is requesting data from, lets say the 1307, but never terminating the transfer with a stop, and then request data from the other device, then possibly both slaves are pulling down the SDA line causing garbled data or bus collisions.
Due_unto:
Without seeing your code, just guessing....
I'm wondering if your program is requesting data from, lets say the 1307, but never terminating the transfer with a stop, and then request data from the other device, then possibly both slaves are pulling down the SDA line causing garbled data or bus collisions.
I doubt something like that may happen as long as there is no noise problem on the lines. Until stop or repeated start comes only those devices selected after the last start are responding. After either reset or repeated start selected devices should consider themselves deselected and wait for their address. Bus contention between slaves may happen only if
More slaves have the same address
Due to week pull-ups, long wires or some interference the slaves see different data - for example one miss repeated start condition or sees one when the master didn't send it.
Since repeated start looks exactly the same as "normal" start there is no way to force slaves into contention as long as they recieve the same data (and follow the protocol, clock speed is not too high, voltage is stable ...)
I have pull up resistors on the ds1307, not on the oled which is working as it is (i guess it has pullups on board?).
The scanner works if just one device is connected. If both devices are connected the scanner will find just the oled (0x3C) and not the ds1307, so it is not a code mistake.
It is very probably hardware problem. Adding more devices incrases capacitance of the bus and that leads to problems such as slower transitions from 0 to 1. What voltage is the OLED? Maybe it is 3.3V with onboard regulator and its pullups are pulldowns from the DS1307 point of view (just a wild guess).
Also note that DS1307 has maximum SCL speed 100kHz. Are you sure you are not running faster? If you are running at 100kHz you may tray reduce the speed a bit "just to be safe".
If you are using library for the OLED it may switch I2C speed to 400kHz (another wild guess) and then it is not suitable for the DS (probably not causing described problem but caveat after you solve it).
Anyway - how strong are your pullups? Possibly making them stronger (3k3? 1k???) may solve the issue - but I am not sure how much current the SDA/SCL pins of your devices can sink. (It may be the other way - the pullups are too strong and DS1307 is unable to pull down??? Hardly but in theory possible.)
You only need one pull up resistor on each of the two wires, 4K7 should do it.
Have you any power supply decoupling on each of the two devices?
Draw a schematic of your system and add a photograph of your wiring, both not just one. Then read the how to use this forum sticky post, and post all your code.
What part of:-
Draw a schematic of your system and add a photograph of your wiring, both not just one. Then read the how to use this forum sticky post, and post all your code
Grumpy_Mike:
What part of:-
Draw a schematic of your system and add a photograph of your wiring, both not just one. Then read the how to use this forum sticky post, and post all your code
Are you having trouble understanding?
No problem sir, i apologize, it’s just i have a very badly drawn -by hand- schematic which is not helping, and also pictures will not be helpfull cause cabling is a real mess and already soldered!
See attachements.
Anyway… i confirm oled has its own pullups, you can clearly see paths on the board going from the pins sda and scl to a resistor (cod103 = 10k Ohm). Also the rtc had 10k Ohm resistors.
I just tryied with smaller resistors (4.7k Ohm) and now i have both rtc and oled working togheter, apparently without issues!
It looks like you don’t understand meaning of pull-up. On the first schematic
the resistors are between SCL(SDA) of RTC and SCL(SDA) of Arduino. It is not pull-up, it may be overcurrent protection of some sort. Pull-up would be from SCL of RTC to 5V and both SCLs connected directly without any resistor. The same for SDA.
Here is the second picture:
Include your pictures into your post next time please.