Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Need recommendation - Need to be a USB host and a USB device simultaneously

Status
Not open for further replies.

toodles

New Member
I need to make a device to act as a USB passthrough, sitting in between a USB device and the USB host. I can find many devices capable of being either a device or a host thanks to USB OTG, but I cannot find any devices capable of being both at the same time. I'll want my microcontroller to do most of the talking as a USB device to the main host machine, occasionally acting as a host to the end device so it can be queried for information as needed.

If anyone has any recommendations on the best or easiest way to accomplish, I would appreciate it. I have a good amount of experience using PICs as USB devices, but nothing about using them as hosts. If any single chip microcontrollers are capable of acting as both a USB device and a USB host simultaneously, that would be prefferable. Failing that, recommendations on fairly easy to use SPI-ish controlled USB host tranciever devices like the MAX3421 would be appreciated so I could use my existing code base with a PIC in device mode, controlling the end USB device with the tranceiver with available pins.
 
If any single chip microcontrollers are capable of acting as both a USB device and a USB host simultaneously, that would be prefferable.

Being USB device and host simultaneously is against USB spec; if you need to make a sniffer, make a sniffer. USB bus is not that difficult to decode, just look at the bus timing and pick a micro capable of this speed. PIC24F will work and you can make a USB device out of it to unload the capture.
 
USB bus is not that difficult to decode? Into binary maybe. Enumeration and data transfers with multiple devices are an unmitigated nightmare.
 
USB bus is not that difficult to decode? Into binary maybe. Enumeration and data transfers with multiple devices are an unmitigated nightmare.

Have you ever done it? What is so difficult in enumeration? Plus, there is no "multiple devices" in USB transfer - there is always one host and one device in a transfer.
 
Last edited:
felis on a common bus with multiple devices a USB device can't just blind itself to bus traffic it has to process ALL of it, from every other device on the system and from the host to every other device.
USB is NOT as point to point protocol.
 
Last edited:
felis on a common bus with multiple devices a USB device can't just blind itself to bus traffic it has to process ALL of it, from every other device on the system and from the host to every other device.
We are not talking about device, we are talking about sniffer. Sniffer only needs to capture traffic, compress it, and unload to a place where traffic can be analyzed and presented(like a PC). Decoding address/endpoint information out of a packet is a piece of cake and for higher level decoding you don't even need to develop an app since there is one already.

USB is NOT as point to point protocol.

I know what USB is. I develop embedded USB hosts for fun. You may look at my site, there are a couple there; I'm working on another one as we speak. When I needed a USB sniffer, I made one - besides saving several hundred bucks it's the best way to learn USB. It was not very difficult; I remember some of my college projects (20+ years ago) being much harder.
 
I'll want my microcontroller to do most of the talking as a USB device to the main host machine, occasionally acting as a host to the end device so it can be queried for information as needed
It's more like a hub situation, but with a specific host in mind on the downstream port. So it's actually hybrid. Host/device to downsteam and device to upstream host. This has aboslutly nothign to do with a passive sniffer. I'm not sure what post you were referring to with your sniffer idea, you can do that in software if you want.
 
Last edited:
I'll want my microcontroller to do most of the talking as a USB device to the main host machine, occasionally acting as a host to the end device so it can be queried for information as needed

I don't think dual USB host/device micros exist, so the easiest route would be to use MAX3421E on a host side. The code to talk to a single device will be quite simple; look at my site, there is almost complete host stack for PIC18/MAX3421E. To make it complete, take a BULK-OUT transfer procedure out of Arduino code from the same place.
 
Being USB device and host simultaneously is against USB spec; if you need to make a sniffer, make a sniffer. USB bus is not that difficult to decode, just look at the bus timing and pick a micro capable of this speed. PIC24F will work and you can make a USB device out of it to unload the capture.

I will certainly look into making a sniffer; I've looked and haven't found any other projects to do it. Any information on yours would be appreciated.
With that said, the device described in my first post still needs the abilities I described. A sniffer won't replace it.
I don't think dual USB host/device micros exist, so the easiest route would be to use MAX3421E on a host side. The code to talk to a single device will be quite simple; look at my site, there is almost complete host stack for PIC18/MAX3421E. To make it complete, take a BULK-OUT transfer procedure out of Arduino code from the same place.

Thank you. I had already come across your site and saw the code there; I'll be digging through the PIC18 code just like you said.
It isn't a PIC, but:
Low Cost ARM Single Board Computer
Two host ports and one USB device port. :)

Appreciated, but way overkill for my needs and skill set. Neat little bugger though.
 
Status
Not open for further replies.

Latest threads

Back
Top