USB Hub Flexible Up/downstream and Power Delivery - Page 1
Forum section: electronics / projects

author: ejlane
author_rank: Newbie
timestamp: April 08, 2021, 11:44:19 pm
content: I'm pretty new to USB overall. I've done some small simple power designs, but nothing too involved. In spite of that, I'm being requested to put together a design and I'm struggling a bit with figuring out how to make everything work. I'm sure that there's a solution, but my overall lack of experience is hampering me. I'm not sure if I even know quite what to ask for!The overall design is an add-on to a phone, basically. I can't give details, but I don't think that is needed. (At least I hope not.) The phone connects to a USB hub chip (I'm currently thinking the Microchip USB7002) and provides power to the device (this is relatively low - I haven't specced it all out, but something like 100-200mA at 5V at most.)The hub is also doing some bridging between SPI and UART devices onto the USB talking to an app on the phone. However, I also need the hub device to be able to plug into a computer for data up/download over to the phone, while also charging the phone. Then if it's plugged into a dedicated charger it should have quick-charge capability.Now onto what seems to be my problem. (I'm also going to try Microchip's forums, but I'm still waiting on admin approval of my account before I can do that.) I think because the chip only supports power delivery/battery charging on its downstream ports that I need to have one of them be the phone. But the computer will not be plugged in the majority of the time, so this would leave port 0 disconnected. I don't know if this is a valid use for the chip.I also don't know if I'm missing some other hub chip out there that is better suited for this. I need a total of three USB-C connections (one for the phone, one for the computer/charger, and the third for future expansion port), as well as a SPI and a UART bridge, but if needed those can be on a dedicated chip.Of course I don't expect anyone to do the design for me, but if anyone out there already has dealt with something similar and has any pointers to offer, I would love to hear them! I let them know upfront that I didn't have this experience, but I was the person available, so I ended up with the project. It's been quite a learning experience already, but I feel like I've hit a wall here, so I wanted to reach out and see if anyone can tell what I'm missing.Thanks!

author: ajb
author_rank: Super Contributor
timestamp: April 09, 2021, 12:49:17 am
content: When the computer is connected, are the peripheral devices meant to be switched over to the computer, or can they be inactive? (The third option is that they stay connected to the phone, but presumably if you're according the phones storage from the computer that's not possible?)Perhaps a pair of USB switches plus appropriate power switches that can swap the phone connector and the computer connector between the upstream and downstream ports? Getting good signal integrity on the USB3 data lines (assuming you need them and this isn't just USB2 via C connectors) would take some care I the layout, unless someone makes a suitable 2x2 crossbar part

author: ejlane
author_rank: Newbie
timestamp: April 09, 2021, 02:40:25 am
content: Yes, when the computer is connected the only real connection needs to be between the phone and the computer. The other devices aren't nearly as important at that step.It would be nice to still have full USB-C speed, but there won't be so much data collected that it is crucial. More worried about the charging speed on the phone battery. Trickle charge just won't cut it. Yeah, I know I might have issues with careful layout. That's something I'm keeping in the back of my mind, and I know that I might not be successful the first time. I'm trying to also look into how to go about that.Actually, I guess I don't need to have the computer really be the host, even, if it can be the device and the phone then initiate transfers. But I don't know where the edges of what is allowed even are.All I really need is for the phone and the computer to have good communication while also allowing the phone to charge. It's the part of having the phone also be able to control the other devices when not plugged into the computer that is really giving me a headache while trying to figure out.Thanks!

author: Renate
author_rank: Super Contributor
timestamp: April 09, 2021, 11:38:17 pm
content: Just to clarify: You are only connecting to the USB on a phone? An Android?This talk of UART and SPI is not electrically connected to the phone internals.In the old world (pre Type C) it was impossible/difficult/easy to make a USB host take a charge.Post Type C it is possible to switch Power Role independent of Data Role (if both sides support it).What if you get this thing done and they decide to use a different brand phone and it doesn't work?The easiest (IMHO) would be to just use the phone as a peripheral and charge naturally.Using the stock ADB you can forward any number of TCP ports through.Add your UARTs and SPI on the desktop.Then you only need a cord.I have built USB 2.0 stuff for phones that dynamically switches direction.Unrelated, I'm using an old eInk display as peripheral with adb forward as a billboard.

author: ejlane
author_rank: Newbie
timestamp: April 09, 2021, 11:58:40 pm
content: Thank you for the reply.The USB7002 has native bridging for the SPI and UART. Using this to communicate between the phone and some data sensors.The whole point is to have a mobile sensing platform that uses the phone battery as the power source. Then charging and data download from the computer.As far as a different brand phone, I'm not sure how much of an impact that would have. My client is simply requesting that I design this piece and he is confident in his selection of the phone and its capabilities. I told him that it would be better to have someone with more experience do it, but he is comfortable with working with me and asked me to try, even with the learning curve. However, I will reiterate again the warning about being possibly tied down to one phone. The thing is that he has programmers that already have a lot done on the app side and want to stick with the phone as a platform for that. They already had a large chunk done before bringing it to me, so changing would be hard and costly at this point.So even if the USB7002 doesn't brag about upstream power delivery, that's just because in >95% of the cases it's not how it would be used? Is any Type C-certified part guaranteed to support this power delivery reversal? That would be great news!Now that you've let me know, I'll go start searching for that. I wasn't thinking about it like that.Thanks!

author: Renate
author_rank: Super Contributor
timestamp: April 10, 2021, 02:24:55 am
content: Let me get another grip on this one.You've got a phone, a black box, a desktop computer.1) Do you want to keep the phone and the black box tightly physically and electrically connected all the time?2) Does the black box have batteries?In some ways, the easiest would be if the black box was always a peripheral, it has batteries for itself (but not especially to charge the phone) and it also has the storage of the collected data.The storage could be a flash drive.Everything is in one direction.Using the phone to power things can be tricky.You're using a charge pump or boost converter to turn 3.7V battery into 5V USB so that something can regulate it down to 3.3V to use!

author: ejlane
author_rank: Newbie
timestamp: April 10, 2021, 06:47:24 pm
content: Sorry for the confusion.1) correct. The phone and black box are basically always connected.2) no. The black box is relatively low powered and gets its power from the phone.Yes, I agree that this is not the electrically best option, but the other team has really tied my hands pretty good on the overall design unless I can prove that there are no work-arounds that I can do to make this work.However, having battery and memory on the black box part and just having it as a flash storage to one or the other might be possible while not affecting their part too much. I'll have to think about that some more, and also about any implications to the power system with charging. Thank you for the suggestion - that one hadn't occurred to me for some reason.

author: Renate
author_rank: Super Contributor
timestamp: April 10, 2021, 07:03:39 pm
content: Well, not to pour rain on my own suggestion.External dumb storage can be tricky if you use standard UMS.It's like giving the keys to your filesystem to a stranger and saying, "You be sure to drive carefully, ok?".The only other way would be if the black box has processing.But that's another can of worms.

author: ejlane
author_rank: Newbie
timestamp: April 12, 2021, 08:22:36 pm
content: Okay, yeah, the PCB also has limited area, and that's already starting to look like it might be a bit tight. Adding more chips to the design is just going to make it worse.I've done more reading on USB Power Delivery, and with its full capability of power direction reversal, it looks like I was probably worrying about nothing. I'm just new enough to this that I didn't even know the right questions to ask, and I also spent time going down rabbit holes that ended up being unnecessary. I was misreading some parts of the datasheet when I did check it, again due to my lack of experience with it all. Of course it doesn't help that Microchip has 8 or more datasheets for this device, with info scattered around in various locations. Then one will say to see another one, and that doesn't exist, but another does with a different name, but similar enough that it's likely what the first had been referring to. (Maybe a name change somewhere along the way?)But I'm getting there, I think!Thank you for your patience and pointers!