I have bought a device which has an ATmega microcontroller and an FTDI chip which connects to a computer through USB. The FTDI is used only as an RS-232-to-USB adapter.

My problem is that this device hangs up the PC when some of the machines are running. I changed the cables to thick, heavy-shielded ones. Also the cable is in a steel conduit. And the device itself is inside a 2 mm stainless steel casing. The case connected is to ground.

Amazingly, the problem is not present when working with this device, but with a plain RS-232 version. (The RS-232 version works even with el-cheapo cable. no problems.)

My questions are:

  1. Is the problem related to a poor design of the device or is the FTDI chip fault? I am now confident that it was due to a bad design of the converter.
  2. What would be the best pick for a chip to convert RS-232 to USB in an industrial environment?
  3. How much work is it to use a microcontroller with a built-in USB port, for example an Atmel microcontroller? Will it be cheaper and faster?

The only requirement is that there must be drivers both for Windows and Linux for the converter.

  • \$\begingroup\$ Do you have a scope? If you scope the TX and RX lines you might see the problem. Also what is the board (Arduino ?) ground connected to or is it powered off the USB? \$\endgroup\$ – geometrikal Apr 10 '13 at 5:28
  • \$\begingroup\$ Oh and how long is the USB cable and why not just use rs232? Does the board have a UART to rs232 converter chip on it? \$\endgroup\$ – geometrikal Apr 10 '13 at 5:33
  • \$\begingroup\$ The machine is now out of my reach. The board was a custom pcb. The power connected to 12V power supply from the PC with common ground. Cable circa 5m long. Now it works superb with the RS232 version of the device. Yes, there is a chip to convert RS232 to TTL. I am asking for a USB converter because I need to build a similar device but with USB. I have built a device with FTDI in the past but now I am affraid that FTDI is not so good in a high magnetic field conditions. \$\endgroup\$ – drzymala Apr 10 '13 at 5:41

At my last company we found that USB-to-RS-232 converters can have a problem when they expect an almost instant responce from the RS-232 device. I was advised by the design engineer for our equipment that USB uses data packets. So when using USB, unless the software/drivers force a USB packet of data to be sent, the USB driver can hang around for more than a second (5000 ms) waiting for the packet to be filled before sending the incomplete data packet.

This meant that a lot of older DOS/Windows programs where they monitored RS-232 status lines would time out. The older programs often used timing loops based on looping a certain number of times... So as the PCs got faster, the polling got faster. As the length of time the polling continued to effectivly get shorter, USB came along.

The polling effectively became a memory location... (The drivers are usually optimised for maximum data packet throughput and didn't pass the status information on, because it was waiting to fill a packet). The drivers can sometimes be adjusted to help with this. FTDI drivers can adjust a lot of values in their configuration file. (Great for non-standard data rates.)

This meant we often had to run programs on desktops with RS-232 ports or drag the laptop base station out to the equipment to get it to work.

Additional information

See page 6 of the application note Advanced Driver Options for USB time out adjustments...

And for odd baud rates up to 3 Mbit/s, see Configuring FT232R, FT2232 and FT232B Baud Rates.

  • \$\begingroup\$ The FTDI driver documents were good the last time I looked and did allow some easy fixes. \$\endgroup\$ – Spoon Apr 10 '13 at 8:09
  • \$\begingroup\$ So which chip/chips would you pick if you were to design a serial-to-usb device? \$\endgroup\$ – drzymala Apr 10 '13 at 8:19
  • \$\begingroup\$ I would clone this design. Not having used it I couldn't swear it's what you need but at least you can try it .ftdichip.com/Support/Documents/DataSheets/Cables/DS_Chipi-X.pdf \$\endgroup\$ – Spoon Apr 10 '13 at 11:25
  • \$\begingroup\$ See page 6 of ftdichip.com/Support/Documents/AppNotes/… for driver options to do with latencey issues. \$\endgroup\$ – Spoon Apr 10 '13 at 11:29
  • \$\begingroup\$ Changing the USB time out resoved our problems.. see the addition to the answer. \$\endgroup\$ – Spoon Apr 10 '13 at 11:35

One possible cause for the problem report described, is a level mismatch between ground at the PC and at the industrial equipment side. This comes from similar personal experiences designing for industrial applications.

Either that, or some significant transients traversing the connections - RS232 is more forgiving than USB in some ways.

One thing to check is whether the two grounds are connected, and even if they are, whether there is significant enough potential difference for measurable sustained current, DC or transient, to be passing along the ground to ground connection / cable shield.

A resolution would be a galvanically or optically isolated implementation: The industrial sensors / actuator control lines to be isolated from the PC side through (a) transformer coupling, or (b) optocouplers, depending on the specific design requirements. The microcontroller device could be placed on either side of the isolation barrier.

In practical terms, the easiest way to implement this, once the need for isolation is established, is to use a standalone USB isolation device such as this one from Olimex, on the PC to board USB connection:

USB isolator.

Another such device is the USB Port Guardian, quite a bit better packaged, but essentially similar in functionality.

Neither of these devices seem to survive well in extremely harsh environments though - we have faced some device failures in deployed set-ups, but your environment may not be as challenging.

At a design level, Analog Devices offers single-package USB isolation parts in their iCoupler line. Incorporating such a part into the design is not very complicated, and the Analog Devices design support team is very proactive if you need help.

Specific to the 3 points in the question:

  1. The problem is most likely to be design-specific as noted above, rather than an issue with the FTDI part.
  2. This would require specifying the actual industrial envornment factors, i.e. temperature et cetera. Maxim and other manufacturers have parts specified for industrial temperature ranges, but if your PC is in there, and presumably its operators, the environment is probably not that harsh.
  3. The jury is out on this one: There are proponents of both the FTDI and the integrated USB MCU schools of thought. The actual cost advantage, including design cost, would vary situationally.
  • 1
    \$\begingroup\$ Thank you for your great answer! The only factor are big induction motors that are creating magnetic fields. I forgot to mention, another device is connected to the same PC through RS485, so it's probably not an issue with signal levels. \$\endgroup\$ – drzymala Apr 10 '13 at 6:05
  • \$\begingroup\$ @martini RS485 is very forgiving in the industrial space, compared to USB: It was designed for harsher electrical environments. \$\endgroup\$ – Anindo Ghosh Apr 10 '13 at 6:10
  • \$\begingroup\$ I agree. RS485 is the winner. But in your opinion is USB better than RS232? I think it is! Because USB uses differential signaling just like RS485. Only with lower voltage. \$\endgroup\$ – drzymala Apr 10 '13 at 6:22
  • 1
    \$\begingroup\$ I've had good success with the Keterex USB-150 isolator as well. \$\endgroup\$ – Adam Lawrence Apr 10 '13 at 12:29
  • 1
    \$\begingroup\$ The isolation issue is very real and I follow it in addition to the pure USB-RS232 timing issue. \$\endgroup\$ – Spoon Apr 14 '13 at 8:39

Anindo's answer is bang on - I strongly suspect you have too much grounding and the PC USB ground is being dragged around by the machinery.

In our experience, FTDI chips are about the best so I'd be very reluctant to blame them as the cause of failure.

USB's data lines may be differential but it is not isolated and the power & GND lines could go anywhere in the target device - not good if the target device has ground connections which are not common with the PC.

Many USB controller chips in PC's will shut down if they detect over-current conditions etc. so it's entirely possible the machinery is dragging the power/ground lines around and giving the PC a heart attack.

I would look at running the 232 to the PC and then having the converter at the PC end, or even converting to RS485/422 (plenty of Maxim chips to do this) and back at the PC end. There are FTDI USB/232/485 boards on eBay for $10, we use a lot of them.

  • \$\begingroup\$ Our machines have common ground and are not using much power. It's the other machines (not connected to ours) that are polluting the air with magnetic waves. The issue was a bad design of the converter. My question now is which of the chips do you personally prefer? \$\endgroup\$ – drzymala Apr 10 '13 at 8:08
  • \$\begingroup\$ Indeed, isolating the serial data lines is likely a more robust (and technically simpler) solution than isolating the USB bus. \$\endgroup\$ – Chris Stratton Apr 10 '13 at 17:59

I am not sure this is you problem, but on my previous PC the use of an usb-serial converter in combination with certain other applications (especially audio and video) could cause my PC to hang and often reboot. This did not happen when I used the same gadget and application with the real (hardware) serial port. I never found out what the cause was, I just learned to avoid watching video during intensive USB serial port use. AFAIR this happended with both FTDI and prolific converters. It could have been a SW problem (windows version, USB stack) or maybe hardware (flaky motherboard). With my new PC (different windows version) I have never encountered this problem. (Which is all the better since it does not have a hardware serial port.)

  • \$\begingroup\$ Thank you for your answer. In my case the problem was directly related to turning on high power electric motors. But yes, now I am using directly the hardware serial port and it is working quite well. \$\endgroup\$ – drzymala Apr 10 '13 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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