0
\$\begingroup\$

Background: I'm attempting to control a stepper driver (+5V logic) with an esp32 module (+3V3 logic). The A4988 datasheet claims to operate at +3V3. And indeed it did ... poorly. It works great at +5V. My idea was to add an I2C port expander (MCP2008) at +5V side then level-shift the [+3V3] I2C bus rather than level-shifting each of the 7 nets I need to operate the driver.

The Problem: Adding the MOSFET level shifts to the I2C bus causes one of my low-side I2C devices (MPU6050) to quit working. The other two low-side devices (SSD3-3306 OLED & WiiNunchuk) work as expected. The high-side port expander also works as expected. If I remove the level shift and run everything on +3V3 logic, then everything works. I suspect that this answer may apply here. But, I'm unsure why only 1 of 3 devices fails (all of which run at the MCU's logic level); and the one device with +5V logic also functions as expected.

I've tried multiple MPU6050s, multiple esp32s (adafruit's HUZZAH32 feather & Doit Devkit1), and multiple level-shift modules. All have the same result. I've also tried with different pull-up values: 2k2, 3k9, 4k7, and none (relying solely on the ones one the level-shift module). I should also mention I have the same results on my PCB version as the breadboarded version. Although even the PCB version does still rely on wires that I crimped myself, I did try ridiculously short wires (about 30mm) as well as swapping them between devices. I also tried without the OLED & Nunchuk devices. I tried the standard 100 kbit/s clock speed as well as the 400 kbit/s full speed.

The Question: I actually have two:

  1. Is there an easy fix or will I need an I2C specific level-shifting IC like the TCA980x?
  2. Can anyone explain why the MPU6050 has an issue with the BSS138 level-shift module sharing the I2C bus?

Breadboard Schematic: Breadboard Schematic

Full project Schematic: Full project Schematic

Full project PCB Layout (Top) PCB Layout Top

Full project PCB Layout (Bottom) enter image description here

\$\endgroup\$
12
  • \$\begingroup\$ Q5 is missing a gate connection, is that true? \$\endgroup\$ Feb 6, 2022 at 20:29
  • \$\begingroup\$ Oops. Those are mistakes in my drawing. The breadboard and PCB versions are correct. I'll update the schematic drawing. \$\endgroup\$
    – aleroy
    Feb 6, 2022 at 20:39
  • 2
    \$\begingroup\$ Look at the signals with an oscilloscope. The low level might be too high, or the rising edges might be too slow. \$\endgroup\$
    – CL.
    Feb 6, 2022 at 21:43
  • 4
    \$\begingroup\$ Please try to make sense where you have pull-ups and how strong they are. You have 2k2 pull-ups on the 3V3 side. Then you have 10k pull-ups on 3V3 side. Then you have 2k2 pull-ups on the 5V side. And yet more 10k pull-ups on 5V side. That's too many pull-ups already, exceeding typical 3mA SDA current. If there are more pull-ups somewhere, maybe the chip can't sink enough current to drive SDA low enough for the ESP to see it as logic low? Take some oscilloscope measurements to see what the problem is. \$\endgroup\$
    – Justme
    Feb 7, 2022 at 0:09
  • 1
    \$\begingroup\$ @ChristianB. Not at all. In fact, I think that is the question I should have asked. After some tinkering I might have everything working at 3.3V. So, thank you. I can move forward again ... but I'm still curious about this issue. I ordered a scope. Hopefully that will help put this rest. \$\endgroup\$
    – aleroy
    Feb 8, 2022 at 4:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.