0
\$\begingroup\$

Due to the ESP32 3.3V logic, I need a level shifter in order to communicate with two 5V logic SDI-12 sensors (two sensors on two different buses.)

I chose the TXS0108 from Sparkfun for this purpose, but I am facing some problems with the bidirectional communication.

Here are the details:

ESP32 RMT

I am using the ESP32 RMT for creating a communication bus between the sensor and the micro controller.

Level shifter setups

I tried different circuits for this setup, but few of these worked properly.

Setup 1

This is the first setup I tried, which is also recommended by Sparkfun: enter image description here

I tied the OE pin to VCCA, with this result:

enter image description here

Apparently, when the RMT pin switches to RX mode, the A side is floating and the output is the following. Note that even with the sensor connected to the B side, the result is similar.

Setup 2

I decided to use a 1k pull-down resistor:

enter image description here

Results were definitely way better:

enter image description here

When I connect the sensor to the B side, this happens:

enter image description here

I even tried with 1k pulldown resistor on both sides but the result is the same.

Current semi-working solution

The following is the only working solution at the moment:

enter image description here

The bus works as expected:

enter image description here

Unfortunately, this setup doesn't work if I try to connect another bus in the same way and they try to communicate at the same time, only one bus works at a time:

non-working setup

The result is the following:

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ How long is the bus? What is the idle state for SDI-12 bus, high or low, when nothing drives it? Is it a push-pull when an output drives it, so not open-drain? How long cables you have and what pull-up/pull-down resistors there are? \$\endgroup\$
    – Justme
    Nov 3, 2022 at 10:23
  • \$\begingroup\$ There are no other pull-up/pull-down resistors other than the one I specified, direct connections are made from the micro to the sensor as you see in the schematics. Connections are currently made on a small breadboard, the temperature sensor cable is about 1m long and the connections to the ESP are about 10cm long. The idle state for the SDI12 bus is low. I can't really tell whether it uses push pull or open drain, can this really make the difference? \$\endgroup\$ Nov 3, 2022 at 10:41
  • \$\begingroup\$ Of course it matters. You need to know on what environment the chip will be used to know if the chip is suitable for use in that environment. Based on what you have told so far sounds like TXS0108 is just wrong chip for the job. Have you read TXS0108 datasheet what it needs for stable operation? \$\endgroup\$
    – Justme
    Nov 3, 2022 at 11:06

1 Answer 1

1
\$\begingroup\$

You don't actually ask any question you want an answer, but here is an answer to questions such as "What can I do to make TXS0108 work with SDI-12" or "Is TXS0108 suitable for SDI-12".

Sounds like TXS0108 is just unsuitable for this SDI-12 level shifting application.

The TXS0108 is much more than a level shifter. It has internal pull-ups and even rise time accelerators to drive a fast rising edge to a bus. Therefore for stable known operation, it needs a stable known environment to work in.

Based on SDI-12 specs, an idle bus must have around 200k pull-down on each device to keep it low when no device drives the bus. Therefore it is a three-state bus with very weak passive pull-down. And when bus is driven, it is driven via around 1500 ohms resistane. Long bus with a lot of capacitance is allowed.

The TXS0108 just does not fit into this environment at all. The SDI-12 bus is bi-directional but neither side is open-drain with pull-up or push-pull when idle or during bus turnaround.

The internal passive pull-ups of TXS0108 are 40kohms which will try to pull the bus high when neither side drives low.

TXS0108 is also very sensitive to capacitive load of data wires. A rising edge is driven to bus with short 30ns one-shot pulse before switching to weaker pull-ups. The data sheet tells to consider lumped load capacitance to avoid one-shot retriggering, bus contention, output signal oscillations, or other adverse system level effects. Even 1 meter of wire sounds excessive for TXS0108.

That tells the chip is not meant to drive long buses with lots of capacitance, it should mainly be used for onboard level conversion or at most between two boards that are right next to each other.

So TXS0108 is too complex and sophisticated for basic use and won't work well with fully tristated buses that are weakly pulled low when idle.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you for your response, what could another solution be? I have also tried with another level shifter from Sparkfun, It worked better, but as soon as the GPIO is put into RX mode, the bus idles to a high state and when the sensor responds, the signal has a slight offset which makes it unreadable for the ESP, I think this has something to do with the GPIO setup. \$\endgroup\$ Nov 3, 2022 at 13:55
  • \$\begingroup\$ @GianniPottermayer That level shifter does not work either. The bus must stay low when nobody drives it. But it floats high because the level shifter has pull-up resistors for that purpose. You don't want pull-up resistors because bus must idle low. There are a lot of circuits how to interface a 5V SDI-12 bus to a 3.3V MCU you can explore. \$\endgroup\$
    – Justme
    Nov 3, 2022 at 14:46

Your Answer

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

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