cancel
Showing results for 
Search instead for 
Did you mean: 

Need 3 cost effective USB ports

HForr.1
Associate II

Currently, my custom PCB with STM32F105RCT6TR based on STM32CubeMX software has a single usb DEVICE port connecting to a display head that must play the role of USB Host. Note I'm also using dual CAN plus 5 analog inputs.

Now I need to connect TWO usb thumb drives simultaneously to my custom PCB, but with that head optionally present or absent. So I need to KEEP that single usb DEVICE, while ADDING TWO usb hosts for reading/writing the usb thumb drives, including FAT support.

I thought of adding an external Vinculum that does SPI-to-USB(dual) bridging, but there are complications there that I don't like. Any of you have STM32 + VNC1/VNC2 experience?

I found the STM32F2 family, including STM32F2?7 series [EDIT 07/30/22: example STM32F207VCT7 {256KB Flash, 132KB Ram}, but I need to compare program flash memory size and ram size, as well as availability, to my current STM32F105RCT6TR {256KB Flash, 64KB Ram}. Or even STM32F205RGT6 looks reasonably priced, same LPFQ-64 package, 1MB Flash, 128KB Ram, I can always downsize Flash/Ram after development settles. Availability seems tough on ALL of them. I like to have in stock before designing pcb!]. It looked like I could connect a traditional hub chip outside the MCU. However, I'm now seeing info suggesting that the CubeMX does *not* support hubs. If it DID support hubs, I like this STM32F2+Hub solution. Does CubeMX possibly support a hub chip with two thumb drives plugged in? Is there a reliable, quick to get running, third party add-on that doesn't force me to lose all the other CubeMX stuff I'm using? (And, sorry, I really don't want to hear about dumping CubeMX altogether, unless the new library easily provides all that and more, for some price.)

Finally, I'm starting to see STM32M1 stuff with built-in hub. [EDIT 07/30/22: Yes, I meant STM32MP1. I thought it had a dual-core and single-core version, where single-core was simply STM32 MCU. However, I think I now find that it always has one or two linux/android suitable cores, plus a STM32 MCU core. So this is too much horsepower and complexity for the job.] I don't know yet if that's a "different world". I'm running simple RTOS on the F105, and I'd rather not go up to embedded linux or such. I can't have that slow a boot, and I have dealt with embedded linux many times in the past -- it's a bad choice for this project.

Any other ideas for how to cost and time effectively get where I need to be?

Thanks!!!

15 REPLIES 15

You can use two mcus, one say 'F2 to handle the two hosts, and an other, say the 'F1, to handle the device.

There are also commercial USB stacks offerings out there, I'm quite sure they include hubs handling.

There may be also other open-source implementations.

It may be possible to adopt the Cube code, I don't know it that well and it may have evolved since I last looked at it (and was not impressed).

JW

HForr.1
Associate II

@Community member​ , LOL, I guess great minds also think alike. I was just discussing with a successor keeping the existing F1 and adding an F2 via SPI or whatever to handle two hosts -- exactly what you said.

That person is probably also going to help looking for other USB stacks. HOWEVER, your mention of the HARDWARE issue concerns me. That gets back to the question of whether that issue might arise for strictly usb thumb drive usage. Again, never occurred to me to ask about USB [EDIT "thumb drive"] speed LS/FS/HS.

Ha! I'm sure you meant "adapt" the Cube code. "Adopt" could have been meant, but that different meaning didn't lead anywhere. I would instead say "FIX" the Cube code. It never intended device trees? Ok, fine, "enhance", not "fix". I'd rather just plug in something free, LOL, that works. They DO exist in other areas. Me and a third person have fixed a few HAL bugs, of course, while HAL is otherwise free. (I mean CubeMX output. I'm not sure of how much historical differentiation there is between CubeMX and HAL. BTW, is HAL from "2001: A Space Odyssey"? I saw an "answer print" several years back, maybe 2001, at a film festival run by Roger Ebert. Fabulous film projection quality. A single visual "tick" in a single frame in the whole movie. Keir Dullea (character David Bowman) was there in person, and Arthur C. Clarke was on the phone from, I believe, Sri Lanka.)

HForr.1
Associate II

@Community member​ , I've at least had a portion of a night to think this over. The dual STM32 F1-F2 solution does offer one major advantage: It reduces the number of unknowns. That's very important at this point.

I believe the largest unknown left by this solution is whether or not (alternatively, how easily) the STM32F2 can *actually* handle two independent USB host connections to two USB thumb drives. Personally, I haven't done ANY usb hosting by STM32/CubeMX at all so far. Combine that with other bugs I *have* found in HAL, and I remain a little apprehensive.

So, do you OR OTHERS have reasonable confidence that an STM32F2 using STM32CubeMX-produced HAL (or more specifically, HAL version 1.8.4 firmware) can use its two USB ports as independent hosts to two USB thumb drives (USB flash drives)?

> HARDWARE issue

No worries. It's strictly confined to the hub+LS device combination There is no LS thumbdrive (OK maybe there are amateur pranks out there, but no normal commercial drive is below HS these days, and there may have been a very few FS drives at the dawn of USB before USB2.0). LS use is mostly restricted to keyboards and mice.

​I don't use Cube/CubeMX.

HAL was a mainframe, conceptually at the opposite pole to microcontrollers in the computer realm.

JW​

HForr.1
Associate II

Thanks, @Community member​ . I'll let you know how things go, along whichever path we choose.

I do disagree with you on one thing. A current STM32 running HAL just *might* have more horsepower than a circa 1968 mainframe, the year of the film, albeit not more than the year of the film's setting. It definitely has more than Apollo on-board computer. 2001's HAL could speak. My smartphone can speak. Sure, my smartphone probably has a bigger processor than an STM32F series, and I guess bigger than an MP1 [with three cores?], but it's not a mainframe. Pole? The pole has been walking, end-over-end, on a capabilities march forward.

Just making fun. I can't imagine the creators of ST's HAL weren't at least aware of Kubrick's/Clarke's HAL. Oh, maybe I'm so dense that I didn't realize *you* were just making fun, too.

Nikita91
Lead II

Maybe the USB stack that comes with Azure RTOS is more mature.