4
\$\begingroup\$

I am trying to sniff on a custom SPI-like bus protocol, which uses a unified bidirectional data line instead of separate MISO/MOSI. To make sense of the communication, I need to split it up into unidirectional lines before feeding them to my logic analyzer. Otherwise I wouldn't be able to see which device is responsible for which part of the signal. Since my devices won't talk to each other unless the protocol is carried out correctly, it's obvious that the bus splitting device has to be transparent to the actual agents communicating.

I tried to construct a bus splitting device, but failed as described here. Since this question was maybe too specific and has not been answered, I want to ask more generally: Is there a bidirectional bus splitter that is able to split 3-wire SPI into four wire SPI? Where could I buy such a device? (This seems similar to this question, only that I'm not talking about two really different protocols, so the answer does not apply). In principle only getting one direction would also suffice, since I could just subtract it from the full signal in order to retrieve the other half. And I'm also only interested in the master side of the communication.


The NXP P82B96 Dual Directional Bus Buffer seems to be a good candidate. Although it's advertised for use with I2C, it seems to be agnostic to the actual protocol on the lines. (As it does not even differentiate between DATA and CLOCK line for I2C.)

Splits I2C-bus signal into pairs of forward/reverse Tx/Rx, Ty/Ry signals for interface with opto-electrical isolators and similar devices that need unidirectional input and output signal paths.

As my devices operate on SPI mode 3 (polarity 1, idling on HIGH), the implementation of the receive pin should work:

  • sense the voltage state of the I2C-bus pin Sx (or Sy) and transmit this state to the pinTx (Ty respectively), and
  • sense the state of the pin Rx (Ry) and pull the I2C-bus pin LOW whenever Rx (Ry) is LOW.

But I am still puzzled on how this would actually work in sniffing this bidirectional bus. I could connect one device with the I2C line and grab its MOSI at Tx and MISO at Rx, but I would eventually have to connect both lines before feeding it to the other device, therefore making it impossible to separate the signals at my logic analyzer again. How can I connect the Tx/Rx for the slave while still being able to read them separately with a third device?

Edit: I now think this is actually not helping at all, since it leaves me with the same splitting issue as with out the device. I already have separate master and slave lines, I just don't know how to join them while still retrieving the separate directions.


I also stumbled upon the Bus Pirate. It seems like this is a device designed for sniffing on buses, but I don't think it can help me in my case. Is there a mode where I can use it as a bridge on a bidirectional line and grab unidirectional signals off of it simultaneously?


Edit: I found this Texas Instruments document on I2C isolation which seems related to the issue. This does supposedly split the bidirectional line to feed it to two unidirectional isolators. The question is: Does this work for my setup? It describes the I2C lines being open-drain, whereas my lines are open-collector and also I'm not entirely sure if I could just leave out the isolator part and grab the signals from the lines or if these would have to be also hooked up to some transistor or be pulled high.

\$\endgroup\$
5
  • \$\begingroup\$ Can't you use the SISO line to determine direction? That is how the logic knows, your LA would show that(?) \$\endgroup\$
    – CapnJJ
    Commented Feb 14, 2019 at 14:34
  • \$\begingroup\$ the SISO line? you mean the MISO line? I don't have a Slave Select line. There is a Handshake line, but it can be pulled low by either side as well. If I'm missing something obvious here on how to determine the direction without splitting, please elaborate :D \$\endgroup\$ Commented Feb 14, 2019 at 14:46
  • \$\begingroup\$ Oh, nevermind, I misinterpreted the 3-wire description. :( \$\endgroup\$
    – CapnJJ
    Commented Feb 14, 2019 at 14:59
  • \$\begingroup\$ If you consider that SPI communication is always initiated from the master side, then you might be able to decode what the master side is sending (assuming your protocol at least follows the master initiation phase). \$\endgroup\$ Commented Feb 14, 2019 at 15:48
  • \$\begingroup\$ It is not alwats initiated from the master side and also the commands and messages are not of uniform length. the length of the answer is fixed for each command, but they are not the same for different commands \$\endgroup\$ Commented Feb 14, 2019 at 15:57

1 Answer 1

4
\$\begingroup\$

I abandoned the original circuit and got it working with a different one. The keyword to look for here is I2C isolation. Because isolation is by definition unidirectional, bidirectional channels like I2C have to be separated before they can be isolated. Texas Instruments has a nice document describing two different methods for isolation.

One of them (ISO154x Method) requires different voltage levels on both sides of the isolator, so that was not feasable for me. So I went for the other (ISOW7842) method. There is a separate document that explains this circuit in detail. I also found an Electronic Design article on the same topic using the same circuit. It includes a detailed calculation of the fine tuned resistor values.

ISOW7842 bus separation circuit

By simply omitting the isolator and grabbing the signals from the separated lines, I was able to achieve what I want. For me only one of the directions was actually separated, but by substracting the signals, one can get both directions indivudually quite easily.

\$\endgroup\$

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.