1
\$\begingroup\$

I want to connect my microcontroller (dsPIC33E) to a PC via USB. Since the particular microcontroller doesn't have a built-in hardware for the USB protocol, I have to use an external chip (e.g. TUSB1106PWR or MAX3454EEUD+), i.e. a USB transceiver that I plan to connect to a UART port of the microcontroller.

The microcontroller has its own isolated power supply (3.3-5V), and what I want to know is do I need to isolate the data bus via optocouplers?

As I see it, there are three options regarding power supply:

  1. To use a separate (isolated) power supply for the microcontroller. The same (isolated) power supply is used to supply the USB chip, i.e., voltage supply and ground pins on a USB connector are NC.
  2. The microcontroller is supplied by its own (isolated) power supply, and the USB chip is supplied by the USB port/cable.
  3. Everything is supplied by the USB - the microcontroller and the USB chip. In this case, I don't need to use the isolation.

Addition to the original question:

Let's say that a microcontroller has its own (isolated) power supply, and the same power supply is used to supply the USB transceiver. Now PC has its own (possibly isolated) power supply. I have a situation exactly like this.

I'll now write a series of questions, I apologize if I oversimplified the questions. Simply yes or no will do with a reference to a question:

Q1. If the two grounds are not tied together, then there is no voltage between the two grounds, since there is no reference point - correct?

Q2. If we tie together the two grounds, that becomes a reference point for the whole system. If both supplies are isolated, or at least one of them, then there will be no voltage difference between the two grounds. Tying them together we would simply reference those two grounds - correct?

Q3. If the two power supplies are not isolated, and they are both connected to the AC mains, then something really bad could happen, since the two grounds can be at a different potential, and they are both referenced to N. If we tie the two "grounds" together, due to the voltage difference current will flow from higher potential to lower, and depending on the voltage difference, something might get burned - correct?

Q4. Since D+ and D- come from the PC side, if we don't tie together the two grounds, then the USB transceiver wouldn't be able to represent voltage levels on D+ and D-, since there is no reference point - correct?

Q5. If USB transceiver operates in a differential mode (it looks for the voltage difference between D+ and D-), then we don't need to reference PC's ground at all, i.e., we don't need to tie the two grounds together - correct?

\$\endgroup\$
  • 1
    \$\begingroup\$ In your case you don't need to isolate and the answers below are fine. There are, however, USB isolation devices specifically for the purpose (i.e. not just optocouplers). They lower the maximum speed significantly but do the trick if you're working with high voltage differentials between PC and device. \$\endgroup\$ – scld Jul 25 '16 at 18:56
  • \$\begingroup\$ @scld Can you please explain what do you mean by "high voltage differentials between PC and device"? When will something like occur? If I tie the two grounds, which apparently I must do in order to reference voltage levels on D+ and D- lines, then this shouldn't happen. What are potential situations in which I would need an isolation USB chip? Thanks! \$\endgroup\$ – Marko Gulin Jul 25 '16 at 19:00
  • \$\begingroup\$ I've made pole-mount devices that, when tested at the bench level, are powered from isolated supplies and the difference between my PC's usb shield ground and the device under test's ground could be measured in volts. In some cases, it's enough to ruin analog measurements. In other cases, it's enough to ruin a PC motherboard. Also, you can't always just tie together two grounds. electronics.stackexchange.com/questions/35800/… \$\endgroup\$ – scld Jul 25 '16 at 19:29
  • \$\begingroup\$ @scld I extended my original post with some considerations (extra questions) on your answer. I apologize if this comment is against the community rules. Please warn me if it's against the rules, in that case I'll delete the comment. Thanks! \$\endgroup\$ – Marko Gulin Jul 25 '16 at 20:00
  • \$\begingroup\$ @Marko Could you tell us what your device is intended for? On a different note, a rough block diagram would also help understand your questions (even if the diagram is uncertain about where to isolate and how). \$\endgroup\$ – Nick Alexeev Aug 15 '16 at 3:21
1
\$\begingroup\$

You don't need to isolate. If you don't, you do need to tie the grounds of the circuits together if you're using the separate power supply.

That said, while you're doing your development, you might just screw up and do evil things. I recommend using a USB hub until you know that everything is perfect. This way, screwups are more likely to take out your hub than your computer's USB port or motherboard.

You can use either the off-board power supply, or use the USB bus to give you power, depending on how much current you need.

You might also consider why you're doing the project in the first place. If it's super important that you have a very quiet ground, you might opt for isolation. Of course, simply isolating and guaranteeing a quiet ground are two different things.

\$\endgroup\$
  • \$\begingroup\$ Ok, if I understand this correctly, if the microcontroller is supplied from its own (isolated) power supply, the USB chip should also be supplied by that power supply, i.e., voltage supply wire from the USB cable is NC. But, the two grounds should be tied together? However, if I isolate D+ and D- via optocouplers, in that case, I don't have to tie the two grounds? Thanks for the help! \$\endgroup\$ – Marko Gulin Jul 25 '16 at 14:23
  • \$\begingroup\$ If you isolate, then tie the grounds together, you are no longer isolated! If the two subcircuits talk without an isolator, they must share a common reference, which is done by tying the grounds together. If they talk with an isolator, you don't need to, and shouldn't, tie the grounds together. \$\endgroup\$ – Scott Seidman Jul 25 '16 at 20:49
1
\$\begingroup\$

The microcontroller has its own isolated power supply (3.3-5V), and what I want to know is do I need to isolate the data bus via optocouplers?

You can't. The USB data bus is bidirectional, and in any case is much too fast for a typical optocoupler. There are some USB isolators out there (e,g. ADUM4160, LTM2884), but they are rather unusual, expensive, and difficult to work with.

But you probably don't need to. Unless you are doing something very unusual, there is generally no need to isolate USB devices. Connect the D+/D- and GND lines straight through, and power the microcontroller either from the USB +5V or from a separate 5V supply.

\$\endgroup\$
  • \$\begingroup\$ Yes, I was afraid that USB can't be isolated using (low-cost) optocouplers. So all I have to do, in a case I use a separate (isolated) power supply for the microcontroller and the USB chip, is to tie the two grounds, in order to reference D+ and D- voltage levels? Thanks for the answer! \$\endgroup\$ – Marko Gulin Jul 25 '16 at 18:56

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.