Electronics > Projects, Designs, and Technical Stuff
Extending the SPI bus for long-distance communication
(1/2) > >>
ArtoLabs:
Hello everyone and what's up my fellow electro-nerds! This is my first time posting so go easy on me.

Inspired by this Texas Instruments PDF I found with the same title as this post, I am attempting to connect 8 slave devices to a master "hub", each connected through a USB 3.0 connector/cable up to 1 meter away.
https://www.ti.com/lit/an/slyt441/slyt441.pdf

Questions: Can I tie together the outputs of the 74HC245 as I have in my schematic to combine together the MISO lines (will this isolate the individual channels)? Are the slave select pull up resistors on the correct side of the 74HC245 buffer (output side)? Should there be pull-up resistors for the MOSI and clock lines? Am I missing anything about the concepts here or have I chose the wrong parts?

I'm new to using buffers and line drivers, but I decided to use the 74HC245 to buffer the slave select lines and the 74HC125 to transmit the clock signal and MOSI lines. There are four 74HC125s, each acting as a dual buffer (MOSI, clock) with 3-state logic.  I chose USB 3.0 instead of RS-422 due to cost of parts and ease of use. Here is a schematic of the hub:

Master schematic
https://github.com/ArtoLabs/Sensi-pot/blob/master/Soil_Sensor_Hub/Soil_Sensor_Hub.svg

I'm using the 74LVC1G125 tri-state buffer on each slave MISO line which sends the return data when it's requested by the master. Here is a schematic of the slave-sensor:

Slave schematic
https://github.com/ArtoLabs/Sensi-pot/blob/master/Soil_Sensor/soil_sensor_kicad_tht.svg

Thanks in advance for any advice or insights you might have. Any advice you can give will go a long way in helping me ensure my prototypes are functional. I'm very excited to be a new member as I watch the show often. I look forward to interacting with all of you!
T3sl4co1l:
Why not tie all the MISOs together without anything -- the slaves only assert that pin when selected, right?

If not, it would seem you do not have SPI peripherals, you have SPI-like peripherals that don't play nicely together...

Otherwise, you need an 8-to-1 mux (74HC151?) to do that; wiring a bus buffer's outputs together will just make a uh, an awful lot of heat...  :-BROKE :scared: ;D

What clock rate are you aiming for here?  Noise in the environment?  Total cable length (all channels added together) -- just 1m cables each, no future expansion?

You say you've "chosen USB3", but nothing in here is interfacing to that standard, you're just using the cables and connectors as far as I can tell, is that right? ???

As far as I can tell, it would be more accurate to say you've chosen "CMOS logic level SPI with shielded cables".  Which is fine, as long as the shielding is maintained, and the output drivers are impedance matched (most likely, source terminated).  Indeed, this is what USB 1.1 does (of course, it uses balanced signaling as well, but the individual signals are plain old CMOS.)  On that note, it appears SHIELD and DRAIN pins are unconnected?

Tim
ArtoLabs:
Tim, thank you for replying.  :-+

--- Quote ---Why not tie all the MISOs together without anything -- the slaves only assert that pin when selected, right?
--- End quote ---
Well, my fear was that if all MISO lines are connected, and each device is at the end of a 1 meter cable, isn't that 8 meters of cable each device would have as resistance when communicating? I'm rather new, but I'm under the assumption that isolating each line is best.  :-//

--- Quote ---Otherwise, you need an 8-to-1 mux (74HC151?) to do that; wiring a bus buffer's outputs together will just make a uh, an awful lot of heat...
--- End quote ---
This is indeed my exact reason for coming here after reading something similar in the 74HC245 datasheet:
https://www.ti.com/lit/ds/symlink/sn74hc245.pdf

--- Quote ---This device uses CMOS technology and has balanced output drive. Care should be taken to avoid bus contention because it can drive currents that would exceed maximum limits. Outputs can be combined to produce higher drive but the high drive will also create faster edges into lightloads, so routing and load conditions shouldbe considered to prevent ringing.
--- End quote ---

A multiplexer makes things a bit more complex, though.

--- Quote ---What clock rate are you aiming for here?  Noise in the environment?  Total cable length (all channels added together) -- just 1m cables each, no future expansion?
--- End quote ---
Very slow, 1Khz. Fans driven by electric motors may be used near by. I'm designing for 1 meter, but suggesting 0.6 meters. That's 8 meters total, no expansion.

--- Quote ---You say you've "chosen USB3", but nothing in here is interfacing to that standard, you're just using the cables and connectors as far as I can tell, is that right? ???

As far as I can tell, it would be more accurate to say you've chosen "CMOS logic level SPI with shielded cables".  Which is fine, as long as the shielding is maintained, and the output drivers are impedance matched (most likely, source terminated).  Indeed, this is what USB 1.1 does (of course, it uses balanced signaling as well, but the individual signals are plain old CMOS.)  On that note, it appears SHIELD and DRAIN pins are unconnected?
--- End quote ---
Tim, that's exactly right. "CMOS logic level SPI with shielded cables" is a much better way to explain what I'm after. I may very well be barking up the wrong tree, but my hope was to keep the design, both hardware and software, simple. I'm using SPI because I'm more familiar with it and the arduino libraries. Oops. I did leave the shield and drain pins unconnected. To ground on one end, right?

Thank you once again for your response and do excuse my ignorance as I'm just a self taught newbie!  :scared:
T3sl4co1l:

--- Quote from: ArtoLabs on April 12, 2019, 02:06:34 pm ---
--- Quote ---What clock rate are you aiming for here?  Noise in the environment?  Total cable length (all channels added together) -- just 1m cables each, no future expansion?
--- End quote ---
Very slow, 1Khz. Fans driven by electric motors may be used near by. I'm designing for 1 meter, but suggesting 0.6 meters. That's 8 meters total, no expansion.

--- End quote ---

Oh, they won't care then, good.  That's plenty of time for signals to settle before clocking, and, you can put a nice slow filter on the CLK line (followed by a Schmitt trigger to sharpen it back up) to prevent noise causing extra clocks.  Probably a 330R in series and 470pF to ground, at the receiver input (~1MHz lowpass).



--- Quote ---Tim, that's exactly right. "CMOS logic level SPI with shielded cables" is a much better way to explain what I'm after. I may very well be barking up the wrong tree, but my hope was to keep the design, both hardware and software, simple. I'm using SPI because I'm more familiar with it and the arduino libraries. Oops. I did leave the shield and drain pins unconnected. To ground on one end, right?

--- End quote ---

BOTH ends!

If the peripheral doesn't connect to anything, and is physically small, you might be able to get away with it, but it would practically be by coincidence.  Any gap in the shield is a path for noise to get in.  At radio frequencies, a gap in the shield is equivalent to a voltage source in series with the signals, with voltage equal to whatever signal is dropped across the shield, depending on the size and shape of the thing.

The only time you can leave one end off, is when electric (rather than magnetic) field, or ground loop current, is the greater hazard.  This is fairly common in audio circuits, and especially common in ancient (vacuum tube) circuits where the impedance is very high (100s kohms being very typical), so magnetic fields are a tiny hazard there.  Regrettably, it's common advice, and common advice changes painfully slowly when the end users do not understand the situation well enough to correct it -- let alone to define and perform experiments that would prove or disprove the efficacy of that advice.  (Another common but similarly questionable piece of "advice" concerns switching supply loop inductance...)

But, given that -- it IS an *RF* susceptibility concern, and if you can just filter that out entirely, it really doesn't matter much if you use shielded cable at all (mind emissions, though -- you'll want filtering at both ends).  This is how USB HID devices can get away with unshielded cables -- very slow, heavily filtered protocol.

Tim
ArtoLabs:
Tim, thanks again for taking the time to share some wisdom with me. I've taken your advice and updated my schematic with a multiplexer, which wasn't as complicated as I thought.


--- Quote ---BOTH ends!
--- End quote ---

Well, your explanation is very compelling. All the peripherals are soil sensors, rather small, and will be powered by the hub.

I also found this interesting forum post on Google that has several compelling explanations for why to connect only one end.

http://forums.mrplc.com/index.php?/topic/24493-shielded-cable-ground-both-ends/

--- Quote --- I have worked in the electromagnetic induction field for over 10 years and I can shed some light on this for you. You only ground ONE end. If you ground both you create a physical loop that is essentially an antenna for stray magnetic lines of flux (noise from other surrounding power)
--- End quote ---

--- Quote ---in an industrial application - probably 95% of time - ground at one end only... sometimes manufacture recommendation will be to ground at both ends as mentioned above... all depends on the grounding of common equipment. exceptions will include audio signal cables - the shield will generally be grounded at both ends and i know that a lot of medical instruments hospitals etc will always be grounded at both ends as well
--- End quote ---

The wikipedia article on the topic sheds some more light:

https://en.m.wikipedia.org/wiki/Talk:Shielded_cable

--- Quote ---Mr. Larry A. West asserts that a shield grounded at only one end is resonant to RF frequencies at its quarter wavelength and will induce voltage to internal conductors at that frequency. He neglects to mention that a shield grounded at both ends also has resonant frequencies and can induce voltage to its internal conductors. No configuration of grounding results in the shield always being a low-impedance path to ground across its entire length, for anything but DC and low frequencies.
--- End quote ---

The soil sensors are used to monitor indoor potted plants, and the sensor itself (the metal probes that go into the soil) is connected to ground. Since the hub is the power source, I assume there's no way for me to achieve a balanced ground between the hub and the sensors (peripherals). So wouldn't leaving the sensor end of the shield disconnected make sense? But as you've said, since my clock frequency is slow, I may not have to worry too much about this at all. However I do find this an interesting topic.  :popcorn:
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod