23

As pointed out, you can't directly connect two hosts to a device - so if you just wired them together and somebody plugged it in on both ends, you'd have a problem. However you also have a problem if only one end is plugged in. USB, especially high-speed (480Mbps) mode is controlled impedance. If you wire both connectors data lines together you end up with ...


21

USB has several layers, which are described in the USB 2.0 Specification. If you're familiar with the OSI layered network model, you can think of it like this: Session layer = Chapter 10 USB Host Hardware and Software (device drivers) Transport layer = Chapter 9 USB Device Framework Network layer = Chapter 8 Protocol Layer (bitstream) Data Link layer = ...


16

How about using an alternative circuit like this: Q4 is a P-mosfet, kept off when there is a voltage in the main supply (USB in this case). When the main supply is disconnected the gate is pulled down and the mosfet conducts and provides output from the battery source. The diodes are Schottky type for low Vf and the mosfet should apparently be ...


15

The generic answer to this question is yes, the VBUS (+5V from cable) must be connected to the device even if it is self-powered. The reason is as follows: To start the connect process on host side, the device must pull up D+ (in case of FS/HS mode), or D- (in case of LS device). However, USB specifications have a mandatory requirement that no USB device ...


15

You will have to implement the USB profile for video cameras, UVC. It's specified pretty intensely by the USB Special Interest Group UVC documentation archive. You'll want to start by reading the FAQ document in there, which explains which document specifies what.


12

I am not sure what exactly you want to make, but if it is a host device you indeed don't need an USB VID/PID. The USB VID/PID of a slave device is used by the host to identify the driver(s) to be used for the slave device. A host device does not need to identify itself to the slave, hence it does not need a VID/PID.


12

It's worth having a USB cable with ferrite 'stoppers' on it, to attenuate conducted emissions along the cable. This will reduce the chance of hash from the switch mode power supply and other PC generated interference 'getting into' the audio circuits of the ADC that's doing the recording. With an electrically noisy PC, and a cheap ADC, a cable without ...


12

The metal shroud around USB connectors is called "shield". The shield serves two purposes, (1) To protect from over-the-air ESD events, and (2) to shield internal high-frequency noise from being emitted out and meet emission regulations for EMI levels. These two processes have different electrical characteristics, so the treatment of shield connection must ...


11

You seem to want to interface to an USB port, so you will need some form of USB interface. The easiest route is an off-the-shelve usb-serial converter, then a max232 or the like, then the UART of your microcontroller. You apparently want to step beyond this. A next step is to use an usb-serial converter chip, without the extra stage of going to RS232 levels ...


11

except if the data length is an even multiple of 256 bytes Its 64 bytes actually (MaxPacketSize). USB bulk transfers "end" with transfers that are not MaxPacketSize - normally 64 bytes long. If your transfer is an integer multiple of that, you send a zero packet after the data. This signals the transfer end to upper USB software stacks, which will return ...


11

This does not work. You will need a USB hub. The USB Y cables you have seen use two USB Type A male plugs to one USB B type plug. Only the power lines are split to the extra plug. This is not conform the USB specification. But it is a small hack to have more than the standard 2.5 Watts of power available, it is used for 2.5" hard disks that can't spin-up ...


11

Is there some method that could monitor a device for very long periods of time with millions of packets going by and find the source of the error? Yes. The device is called "USB protocol analyzer". If you monitor only the host software side, the maximum you can see is that there was some "transaction error", and the port can or can't recover after ...


10

The real problem is not the unprotected USB port, the real problem is that your device puts you and your devices at risk of being connected to higher-voltage, relatively high-current sources. You can solve transient overvoltage with clamping diodes, but these won't help if you power supply is strong enough – they will just fail, and then you're in the same ...


9

Just like Stéphane, I came here for the answer. Which I did not find here! With a little research this is what I found. With a host controller you will be able to communicate with all USB devices, and with a USB device controller you can just communicate with a host controller. USB host is the USB on the PC side in most cases and USB Device is the USB in ...


9

Some cheap usb hubs, are really really cheap, and do not follow appropriate standards. Some are so cheap, that they have all of four components. An all in one usb hub IC, a crystal clock, a decoupling capacitor, and an led. Input VCC is tied together to all the output VCC. These are not the best devices in the world. That said, because VCC is tied together, ...


9

It will work, if that's what you're asking. And there is no law saying you must buy a VID from the USB-IF in order to use USB - you only get in trouble if you use the name and logo without permission. Some things to consider: If you do want to insert a computer, to do debugging or something, life will be easier if you have a unique VID/PID combo and can ...


9

Multiplexer as suggested by Tom Carpenter is a good solution. But for full speed USB (12 Mbps), the stubs in the signals are not particularly important. If the distance between the stub ends remain below 1/10th of wavelength, i.e. below ~2 meters, the reflections will not distort the waveform much. Also, the voltage levels on D+ and D- pins will remain ...


8

I believe the original 1 ms (1 kHz) start of frame interrupt was to give devices to cheap but accurate timing. The accuracy spec on that is rather tight. If you don't need to do accurate timing, or you have your own crystal, then you don't need to know when USB frames start. The host initiates all transactions, even when you send, so your hardware and ...


8

With 22 pF to ground, the link won't work. Having 22 pF is a brutal violation of USB 2.0 signal requirements. When you loaded the data bus with such huge caps, the HS (480 mbps, 240 MHz) signals are severely degraded, below borderline of HS communication. Yet the initial speed negotiation (chirping sequence), which occurs on 10 kHz rate (50 us pulses), ...


8

First of all, the USB is not being fed directly to the phone’s battery. It’s actually being fed to the battery charger circuitry inside the phone. You cannot safely directly connect a normal regulated voltage source to a lithium ion battery without the distinct possibility of an explosion and/or fire! The charger circuitry adjusts the voltage and current fed ...


8

As noted in Marcu's answer, you need UVC. This blog has a series of posts that works through the process of interfacing a camera and then implementing UVC on several different devices, including a microcontroller and a dedicated ASIC: https://www.circuitvalley.com/2019/12/diy-cypress-fx3-usb3-usb-3-uvc-camera-ov7670.html The source code and linked technical ...


7

I have worked on commercial KVM units and can attest to the fact that they are way more than a trivial exercise to design and get working. One of the challenges in such a design is capturing the analogue waveforms of the VGA/SVGA/XGA/WXGA video signals from an arbitrary computer and converting that into a digital format that can then be processed in the ...


7

USB 2.0 is quite inefficient, compared to USB 3.0. There are Link commands and other transactions, meant to keep the link healthy and operational, that do not carry data. There are ACK packets for nearly every received data packet, and because the bus is uni-directional, those disrupt the data transfer. There is error detection and correction information ...


7

The link http://www.usb.org/developers/tools/comp_dump died during September 2018. The official and new file can be found here (this took a while to find): https://cms.usb.org/usb/api/usbif.json Note that the format is now JSON and all obsolete vendors are also included.


7

As USB is a digital signal, no, interference will not cause the audio to change. But USB audio is normally delivered via isochronous data transfer (think UDP), a best effort non-error correction protocol. USB uses Manchester encoding on differential twisted paired data lines to reduce the effect of any interference, as well as the shielding. USB does have ...


6

The phrase you are looking for is "Vampire Power." Most phone chargers will have it, but will be minimal, like a few cents a year per cell charger in energy usage. Computer power supplies will be worse. And anything that is on a standby mode, like sleeping computers, TVs, game systems (like the PS2/3, Xbox 360/One, Wii), microwaves, etc. will consume power ...


6

You can only check if the PC can communicate to the programmer. You can't check if the programmer can interface with an (unconnected) microcontroller. I don't have such a programmer to verify the exact workings, but the concept should be a bit like this: Recipe Execute this command: avrdude -p attiny13 -c usbasp -P usb -v -U flash:r:/dev/null:i It will ...


6

Yes, you should have ESD protection on all external connectors, including power, USB, audio, SIM cards, SD cards, etc. It is considered good practice to include them. ESD damage has become more of a problem as the geometries inside IC's shrink, making them more susceptible. I haven't seen any statistics on ESD damage, but I would guess -- and this is only ...


6

Dry joints and dodgy connections can act as diodes. Diodes can demodulate radio signals. That's basically how old "cats whisker" radios (crystal radios) used to work. It sounds like the bad connection is picking up the radiated noise (EMI) from switching your light on and off and interfering with the USB data stream. Get yourself a new keyboard, dude...


Only top voted, non community-wiki answers of a minimum length are eligible