EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: PepeK on August 31, 2014, 01:34:27 pm

Title: Is a cable's lenght of an USB to serial adapter important ?
Post by: PepeK on August 31, 2014, 01:34:27 pm
I have the USB-to-serial adapters like on the picture. Chipset CH 340 G. Works fine when inserted directly into a computer's USB port. I have decided to build a STK 500 compatible programmer and soldered extension wire to the USB adapter pins (V+, D+, D-, GND). It does not work. When I started to make the cable shorter and shorter, at approx 25 cm length everything works again. Does anybody has a similar experience ?

BTW, another adapter based on the  PL 2303 works without any troubles on 1m USB cable. Only this CH 340 G seems to be sensitive to a distance between a chip itself and a computer's USB port.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: void_error on August 31, 2014, 01:44:53 pm
I think it has to do with the data rate of your USB device. I had a similar issue with USB cables. My PICKIT 3 would work with a 3m cable while my webcam wouldn't work with anything over 2m.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: nctnico on August 31, 2014, 01:54:18 pm
The quality of the cable and the connectors are also a very important factor. It helps to not buy the cheapest cables.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: m.m.m on August 31, 2014, 02:13:26 pm
I guess adding a Ferrite would solve the problem, also fluorescent lamps may cause issues sometimes.
sometime ago I had a fluorescent lamp, when I turned it on and off, I heard usb disconnecting sound from the speakers. (that was because my mouse wire is too long and acted as an antenna)
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: SeanB on August 31, 2014, 02:37:53 pm
Data pair needs to be a twisted pair. If you use a flat or non twisted cable you will be severely limited in length. Why not just buy standard 2m long USB extension cables, as I have had little issue using them just to extend a cable to the front of a desk as the front mounted USB was at an inconvenient height.

As well consider a externally powered hub as well, you get some spare USB ports that can also be used to power the DUT as well if it is capable of being powered by 5V at under 1A.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: Pedram on August 31, 2014, 02:38:25 pm
years ago i used FT232RL with 12m cable for a project. (without power) and it worked fine.

make sure you use a shielded USB cable.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: T3sl4co1l on August 31, 2014, 03:00:28 pm
Shielding is most important to avoid interference.  Twisting isn't fundamentally a problem as long as the signals get there, but bad signal quality would account for the problems at whatever distance.  It would be quite typical of cheap crap to lack on matters of output impedance, rise time control, termination resistors, etc...

USB is strictly point to point, what exactly were you doing to 'extend' to the STK500 device?  And what made you think it would work at all...?

Tim
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: PepeK on August 31, 2014, 04:03:42 pm
Thank you  for replies. Just to clarify :

I am using a shielded USB cable A to B type (it is used to connect printers, scanners, monitors etc.) - so it is an original USB. I simply removed the "B" end and soldered wires to the USB connector of adapter. I started with 1m and continued by cutting 20 cm parts. Only for length less than 25 cm it is ok.

It is interesting, I have also short extension cable (50 centimeters) and when I apply it to the working version, things stops working ...
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: SeanB on August 31, 2014, 04:25:59 pm
So likely the cable you are using is only a USB 1.0 or 1.1 rated cable. Try using a USB 2.0 cable instead, like you got with an old cellular phone as a data/charging cable ( must be the data one though as the charge one is only 2 wires) as this will have better performance with USB2.0 speeds.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: PepeK on August 31, 2014, 04:31:46 pm
So likely the cable you are using is only a USB 1.0 or 1.1 rated cable. Try using a USB 2.0 cable instead, like you got with an old cellular phone as a data/charging cable ( must be the data one though as the charge one is only 2 wires) as this will have better performance with USB2.0 speeds.

It is for 90% USB 2.0 cable, it is unused computer - monitor connecting A-B cable. The monitor is LCD flat, having build in USB hub.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: SeanB on August 31, 2014, 04:37:45 pm
Those built in hubs often are only USB1.0 or 1.1, being there most commonly to connect a keyboard, mouse and possibly a printer to the computer with a single convenient cable. I have met many that are like that, unless it is a new design monitor that has been made in the last 5 years or so where they might have put in a USB2.0 chipset instead as it was cheaper due to mass production. A lot of old monitors have the hub unused because of that.
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: PepeK on August 31, 2014, 04:46:45 pm
The 50 cm extension cable, I mentioned above works properly with an USB memory stick, no errors, full speed.
When used for USB-to-serial adapter, it stops working. This lead me to a conclusion, there is something wrong with the CH 340 G  chip itself. Maybe Chinese comrades designed something cost-saving (not properly terminated inside and any long wire causes reflections). What do you think ?
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: aargee on August 31, 2014, 09:55:06 pm
Would it be better to have the USB dongle plugged directly into the port and run the RS232 over the distance? RS232 is more apt at running distance than USB?
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: PepeK on August 31, 2014, 10:14:36 pm
Hello everybody,

the mystery is solved now. It is not a problem of cables nor CH 340 G (apologies to its manufacturer  :) ) It is a problem of the small module (its photo is in the first post). I desoldered CH 340 G plus 12 MHz crystal, soldered to SOP16 - DIL adapter, inserted into a breadboard and such a surprise, everything works for any speed between 1200 baud to 234 000 baud. Any USB cable can be used, also an A-B to cable can be chained with 1m long A-A extension cable.

Maybe the module's PCB has some insulation problems or its design is totally wrong (parasitic capacitance etc.).

Thank you for advices. Again one lesson learned - do not believe cheap eBay items  :)
Title: Re: Is a cable's lenght of an USB to serial adapter important ?
Post by: PepeK on September 01, 2014, 09:36:36 am
Final conclusion : the CH 340 G has an internal 3.3V regulator, its output must be decoupled with a 100n capacitor. There is nothing or a smaller value is used on the module I have purchased. When soldered 100n capacitor, all troubles with a long cable are away, also on the module which has not been working before.