DIY KVM SWITCH (USB3/DP/DVI/Audio) - Page 1
Forum section: electronics / projects

author: 3dgeo
author_rank: Frequent Contributor
timestamp: July 25, 2020, 02:12:42 pm
content: Hello,I came a crossTS3L501Eand want to play with it by making a KVM.I'm hoping to get away with 2 layer PCB and hoping noise will not be an issue due to signals being diff pairs.Maybe there is a better ICs for that? Maybe I'm missing something? I've never played with DP/DVI signals.Here is my crude diagram (will power it from USB input):DP part:USB part:

author: girishv
author_rank: Regular Contributor
timestamp: July 25, 2020, 02:30:38 pm
content: Checkout TS3DV642 athttps://www.ti.com/product/TS3DV642TS3DV642 allows you to switch DVI, DisplayPort, HDMI, LVDS, TMDS, VGA. Very inexpensive.There is an evaluation modulehttps://www.ti.com/tool/TS3DV642EVMYou will find a schematic in the user guide of evaluation module.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: July 25, 2020, 03:02:36 pm
content: Quote from: girishv on July 25, 2020, 02:30:38 pmThanks! Way better IC, tho its pinout is terrible, will need to jump layer to route it out. Sloppy job by TI...

author: girishv
author_rank: Regular Contributor
timestamp: July 25, 2020, 04:07:24 pm
content: Quote from: 3dgeo on July 25, 2020, 03:02:36 pmI have been eyeing this since 3-4 years for a DIY KVM switch. I was only looking for keyboard, display and mouse switching. I never got around to building one.I was considering using a DPDT USB switching IC with a separate USB hub for sharing one USB connection between keyboard and mouse.Something likehttps://www.onsemi.com/products/interfaces/analog-switches/fsusb42Checkouthttps://www.microchip.com/ParamChartSearch/Chart.aspx?branchID=1622for some inexpensive USB hubs.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: July 25, 2020, 05:46:37 pm
content: My monitor has built in hub, but probably it's be good idea to add extra one.I also want to add RNF24 module so I can use it with my little NRFs network...Thanks again.

author: phil from seattle
author_rank: Super Contributor
timestamp: July 25, 2020, 06:15:19 pm
content: Quote from: girishv on July 25, 2020, 02:30:38 pmFor what it's worth, the URLs have periods at the end that TI web site doesn't like.Product Page:https://www.ti.com/product/TS3DV642Eval module:https://www.ti.com/tool/TS3DV642EVM

author: girishv
author_rank: Regular Contributor
timestamp: July 26, 2020, 01:18:28 am
content: Quote from: phil from seattle on July 25, 2020, 06:15:19 pmVery strange. I had same problem. I suppose the full stop at the end of URL created problems. Here are the correct ones.https://www.ti.com/product/TS3DV642https://www.ti.com/tool/TS3DV642EVM

author: tbowmo
author_rank: Newbie
timestamp: July 26, 2020, 11:10:16 am
content: I'm working on a K(v)M switch, only doing USB so far though, and only HID devices.. My end goal is to switch 3 video signals, and keyboard/mouse, between 4 computers (company laptop, my personal laptop, desktop computer, and a raspberry pi).My approach is to have 5 atsamd21's, one as controller, 4 as peripherals. The controller handles USB keyboard / mouse (USB host), while the others are connected to the 4 computers. I have I2C and SPI as backhaul between the controller / peripherals. I plan to use SPI for the keyboard / mouse events, and then the I2C as a secondary command bus (both controller and peripheral can act as a master on the I2C bus).For switching video, I had plans to use a couple of inexpensive 4 to 1 HDMI switches, (I currently got one). It has an IR remote that I could tap into and send commands to switch inputs.The above is still in design phase, as I have only just finished pcb layout today.. And I'm still adjusting things here and there..

author: tooki
author_rank: Super Contributor
timestamp: July 26, 2020, 01:45:09 pm
content: Quote from: 3dgeo on July 25, 2020, 02:12:42 pmThat could never have worked anyway. That switch chip lists bandwidth of 600MHz, but USB 3 requires severalgigahertzof bandwidth, as it has a clock rate of 2.5GHz. (OneTI USB 3 switch IChas bandwidth of 10GHz!) Bear in mind that this makes laying out USB 3 quite critical. (USB 2.0, on the other hand, just needs 240MHz of bandwidth and would be much less critical to lay out and switch. Seehttps://www.analog.com/en/analog-dialogue/articles/switching-in-usb-consumer-applications.html)DP is similarly needy. Digital display connections are extraordinarily high-bandwidth connections — the upcoming DP 2.0’s raw data rate is 80Gbps, which is absolutely insane if you think about it! That’s across 4 lanes, so 20Gbps per lane, which is still crazy! (Dual-link DVI is a mere 9.9Gps total across 6 lanes, with a clock of up to 165MHz.)

author: 3dgeo
author_rank: Frequent Contributor
timestamp: July 26, 2020, 08:31:12 pm
content: Quote from: tbowmo on July 26, 2020, 11:10:16 amYou are overthinking it massively, simply use ICs girishv posted and control them with one small MCU (STM8 in my case).I bet decoding USB signal, sending to other MCU and encoding it again will add massive amount of input lag too.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: July 26, 2020, 08:36:00 pm
content: Quote from: tooki on July 26, 2020, 01:45:09 pmI don't get this part with bandwidth – why should one care if IC being turned on to one input and stays on, should it pass "unlimited" amount of bandwidth? It does not manipulate/change signal in any way, not like FPGA...

author: girishv
author_rank: Regular Contributor
timestamp: July 27, 2020, 12:57:19 am
content: Quote from: 3dgeo on July 26, 2020, 08:31:12 pmWe can explore cascading 3 TS3DV642's to form a multiplexor supporting four inputs. It would be interesting to see how cascaded TS3DV642's behave. I remember checking in TI forum without any concrete answer.We need a different USB switch as the one I suggested supports only two ports.

author: tbowmo
author_rank: Newbie
timestamp: July 27, 2020, 08:02:04 am
content: Quote from: 3dgeo on July 26, 2020, 08:31:12 pmIf I just use a simple switch, I can't create hotkeys to switch pc. I have to control the keyboard / HID device, in order to know what keys the user presses..I could go with another architecture, where I only decode and encode to one endpoint, and then switch that endpoint to whatever PC I want it to be attached to (lowering the number of MCU's), I even found a MCU that have two USB devices (both host and client), so I could use a single MCU for the thing. However with my design, each computer always thinks that it has keyboard / mouse / HID attached, as it has a dedicated USB (HID) device attached at all times. I can also send the same keyboard sequence to all attached computers (for example, if I hit GUI + L to lock the computer, I could send the same sequence to all attached computers).There might be lag, doing decoding, transfering over SPI, and encoding again.. But I think it would only be of concern for a pro gamer, that needs nano second response times from his keyboard..As said earlier, this is just a concept on the drawing board..

author: 3dgeo
author_rank: Frequent Contributor
timestamp: July 27, 2020, 11:58:51 am
content: Quote from: girishv on July 27, 2020, 12:57:19 amWell, that IC can be turned off, so using 2 ICs will give 4 inputs and one output. With it you can even switch 2 USB3s simultaneously or add audio/mic channels.

author: tooki
author_rank: Super Contributor
timestamp: July 27, 2020, 12:48:39 pm
content: Quote from: 3dgeo on July 26, 2020, 08:36:00 pmOh boy…OK, first off, just to make sure we're on the same page, the "bandwidth" we are talking about here isnotbandwidth in the computing sense (meaning maximum data rate, measured in bits or bytes per second). So we aren't talking about digital processing of the signals at all. Instead, we mean the analog signal bandwidth (measured in Hz).Analog bandwidth can actually mean a few closely related things, but here, we mean "what is the range of frequencies that can make it through without too much signal loss". (This can be of a single component, all the way up to a system as a whole.) When a datasheet for an IC lists bandwidth as a single frequency, it's shorthand for "everything from DC all the way up to this frequency". Customarily, bandwidth limits mean the limit frequency where the signal going in is attenuated (weakened) by -3dB, which means an output level of about 0.707x (precisely, 1/√2)] the input level, which is half the total power. So if a system's bandwidth is specified as 100MHz for example (say, in an oscilloscope), then it means that a 1V AC signal at 1KHz will show up as 1V, but a 1V AC signal at 100MHz would show up as about 0.7V. Every frequency above that 100MHz will be attenuated even more.Now, what does analog bandwidth have to do with digital signals? Well, digital signals still live under the analog physics of the physical world. (Digital is actually an abstraction, not a physical reality. Digital is simply a way of interpreting a signal.) A digital signal is still ultimately transmitted in the analog world, be it as a voltage level, polarization of light, etc. Being that digital signals are just a subset of analog signals, all the rules of analog signal theory still apply. Where it gets icky with regards to bandwidth is that the square waves we think of when we think digital a) aren't actually what many digital signals use (many signals are actually multi-level, or multiple analog signals in parallel, etc), and b) don't actually exist in the real world. What? How? Well, in the physical world, all signals are ultimately sine waves. (They're just the sums of many sine waves.) A square wave is actually the sum of an infinite number of sine waves, namely, the fundamental frequency, plus all the odd-numbered harmonics (frequency multiples). So a 1MHz square wave is actually the sum of a 1MHz sine wave (the fundamental), plus a 3MHz sine wave, a 5MHz sine wave, 7MHz, 9MHz, 11MHz, all the way to infinity. Now, in practice, no system has unlimited bandwidth, so the theoretical square wave is actually never quite truly square in shape in reality.But the key message here is that a square wave needs a lot more bandwidth than its stated frequency would imply. If you don't have enough bandwidth, the cleanness of the square wave gets degraded, until ultimately becoming a single sine wave, and then getting weaker and weaker. To use the analogy of audio, it's like throwing blankets over a speaker: the highest frequencies get lost first, and as you add more, the sound gets more and more muffled, until all that makes it through is the thumps of the bass. (The blankets act as a "low pass filter", which is how many components behave.)So, with those basics out of the way, let's address your question:Quote from: 3dgeo on July 26, 2020, 08:36:00 pmNo. No component in existence has unlimited bandwidth. The laws of physics apply, always. Read on:Quote from: 3dgeo on July 26, 2020, 08:36:00 pmEverycomponent changes a signal in some way, asallcomponents have unwanted but inherent and unavoidable ("parasitic") properties of resistance, capacitance, and inductance. So in effect, every single component you use is an analog filter of some kind. Now, in many cases, this effect is so small as to be completely ignored. But not always.So while that 600MHz switch will appear completely transparent at, for example, audio frequencies, if you fed a 600MHz sine wave into it, the output signal would only be 70% as large. And if you tried feeding a 2.5GHz sine wave into it, it's unlikely that anything would come out the other end at all.Another analogy to demonstrate the idea of bandwidth is image resizing. You know how if you take a nice, sharp, detailed image and use good software to progressively shrink it down, little details get blurred together, until they disappear altogether? That's bandwidth at play.(And don't think that bandwidth limits are something that only matter with high frequencies: the parasitic effects of the first undersea telegraph cable were, at those lengths, so pronounced that it tooktwo minutes per characterto send a message!)USB 3 isextremelysensitive to, well, pretty much everything in its signal path. (It's a miracle that it can be implemented so cheaply in so many devices!) Cable and component selection, PCB layout, it all matters. And because the frequencies involved are so crazy high, youliterallyneed to spend $100,000 to get an oscilloscope that can even display a USB 3 signal, meaning that debugging USB 3 circuits is effectively impossible for the hobbyist.So if you do everything by the book, you'll likely get something that works, but you'll have no way of troubleshooting it if it doesn't work.For your project, given the level of knowledge I suspect you have, I think USB 3 is biting off more than you can chew. If it's just for input devices (keyboard, mouse, etc), USB 2 is more than enough. In fact, USB 1.1 is all most input devices even use. That'd be a massively less demanding design, and you'd never notice the difference. (If it's USB-C you want, bear in mind that you can do just USB 2 using a USB-C connector.)