1
\$\begingroup\$

I have a circuit with an RTC (DS1307) and an LCD display, both connected to an I2C bus. Because the RTC requires a 5V level (the RTC breakout I use has built-in pullups) I also use a level shifter.

Simplified schematic

The cable that connects the RTC with the breadboard is an 8-wire flatbed cable (the other wires are currently unused), about 20cm long. With this setup, nothing works. Neither device is recognized on the I2C bus.

Now if I disconnect the SDA wire to the RTC (the orange one) and replace it with a separate wire all of a sudden, everything works as expected and both the display and the RTC work just fine. There's nothing obviously wrong with the wire (such as a shortcut).

I have tried to compare the signals I get with a scope, but don't really understand the difference.

Signal form when it does not work Signal form when it DOES work

The first picture shows the scope output of the signal, measured at the RTC end, when the communication does not work, the second shows the same signal (maybe not exactly with the same data) with the separate wire. The only difference I see are those tiny peaks. But whether that's ok or not I do not know.

Is the I2C bus so sensitive to cross talk that the parallel wires cause the problem? In another project, I have a 10m I2C bus connection in a single cable, and it works fine.

Edit

The flatbed cable I use has the following wires (in this order): white (5V), grey (NC), purple (NC), blue (NC), green (NC), yellow (SCL), orange (SDA), red (3.3V) and brown (GND). The RTC breadboard is actually this a bit more complex type, but I only use the RTC of it (It's not possible to stack that to the Arduino Due).

Edit2

I also added the scheme. the problem is in the wiring on the far right, between the level shifter and the RTC. The level shifter is this type from Joy-It

Here's the scheme

\$\endgroup\$
5
  • \$\begingroup\$ Welcome to EE.SE! Please draw a schematic with the built in tool here by clicking on edit and the schematic symbol. \$\endgroup\$
    – winny
    May 16, 2021 at 11:22
  • \$\begingroup\$ What is the mapping of the signals and power supplies in the flat cable? That might explain what you are observing. Also your level shifter might be completely incompatible with I2C, please state which level shifter it is. \$\endgroup\$
    – Justme
    May 16, 2021 at 11:29
  • \$\begingroup\$ Yes, the flat cable pinout could very well be a problem. But before I answer I need the level shifter (converter) type. \$\endgroup\$
    – Justme
    May 16, 2021 at 11:51
  • \$\begingroup\$ @winny: I don't find any ICs or microcontrollers in that tool, so how's that supposed to help? I'll add the scheme from fritzing. \$\endgroup\$
    – PMF
    May 16, 2021 at 12:02
  • \$\begingroup\$ @justme: Added the type. It's this one from joy-it: joy-it.net/de/products/COM-KY051VT It has 4 bidirectional channels. \$\endgroup\$
    – PMF
    May 16, 2021 at 12:08

1 Answer 1

4
\$\begingroup\$

There are two problems.

The larger problem is that the level shifter is not suitable for I2C communications. It has built-in rise time acceleration. A much simpler level converter is more suitable for I2C.

The smaller problem is that the flat cable wiring has SDA and SCL next to each other, which will enable crosstalk between the wires.

The rise time acceleration combined with crostalk causes the rise time accelerator to cause SCL risin edges to couple to SDA which causes the extra large spikes seen on SDA.

The extra spikes should not be present on the SDA.

\$\endgroup\$
4
  • \$\begingroup\$ Unfortunately, I do not have a different converter. I know how to create uni-directional converters using resistors or transistors, but this here needs a bidirectional one. Would this one be better suited? sparkfun.com/products/12009. \$\endgroup\$
    – PMF
    May 16, 2021 at 13:35
  • \$\begingroup\$ Using a different wire pair doesn't seem to help, so the distance really needs to be far. I'll try to reorganize my breadboard, so that I can directly connect the breakout onto it. (the actual board has some more components on it) \$\endgroup\$
    – PMF
    May 16, 2021 at 13:37
  • \$\begingroup\$ Yes the pure FET based level translators are suitable for I2C. I don't think it can ever work reliably with the completely unsuitable level translator that tries to push the signal high, that is not allowed in Standard or Fast modes. \$\endgroup\$
    – Justme
    May 16, 2021 at 13:54
  • \$\begingroup\$ Ok, I'll try to order one of those and see whether that improves the situation. I do see some other weird behavior that could be related. \$\endgroup\$
    – PMF
    May 16, 2021 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.