What's the next step up from basic USB bridge? - Page 1
Forum section: electronics / general

author: imacgreg
author_rank: Contributor
timestamp: January 13, 2024, 10:01:38 pm
content: I am pretty familiar with UART to USB bridges (FTDI cables) in microcontroller designs for creating an accessible terminal and that works great for very simple printf/scanf style debug interfaces.I am starting to work on a project that will consist of a hardware device (with STM32F4) and will need to connect and communicate with custom software running on a PC via USB. Currently we use a UART-USB bridge + COM port/terminal on PC. Eventually the terminal functions will get rolled into custom software.I am curious about what options exist to replace the UART-USB bridge with something that is more flexible and could support a custom vendor ID. It would still be used for communicating with the hardware F4 via UART, I2C, etc. We would also want to support DFU through this device as well.Assume that I want to avoid rolling the USB into the hardware master F4. Is there a simple micro out there that would support this? What is the simplest or cheapest or smallest way to get a USB PHY?Looking forward to suggestions!

author: coromonadalix
author_rank: Super Contributor
timestamp: January 13, 2024, 10:18:28 pm
content: check on many nucleo boards on how they implemented usb from the main mcu in some cases, other are using st-link embarqued programmer ??i dont know why you seem reluctant to use integrated usb interfaces, some have dfu modes / boot loader, usb host mode etc ... move a jumper, flash your program, remove jumper do a reset and voilaare you short on code size / space ?but now ftdi proific and othe usb / uart ic's do not take place on a pcb, you have very small packages under 5mm square,thus they can provide some protection too, you will need to add a few protection on the usb line going into the mcu if its an commercial or industrial usecheck for ideas : sure they use cp2103 uarthttps://github.com/SmartArduino/WiFiMCUhttps://raw.githubusercontent.com/SmartArduino/WiFiMCU/master/Document/WiFiMCU_SCH.pdfother approach, i think it was usb to the stm32 no interface well known boardhttps://stm32world.com/wiki/Black_Pillhttps://github.com/trebisky/stm32f411

author: imacgreg
author_rank: Contributor
timestamp: January 13, 2024, 10:36:40 pm
content: Hi thanks for the responseGood call on the Nucleo board, I will take a look.I am reluctant to use an integrated USB interface as it is unclear yet if something beyond a simple bridge is required. Also, due to hardware/space constraints in this design, the bridge is currently/conveniently located on its own small PCB separate from the main MCU board. This allows us to develop the main MCU & hardware while handwaving away the USB stuff, for now.The amount of handwaving is starting to make me a little nervous which is why I am researching other options...

author: ataradov
author_rank: Super Contributor
timestamp: January 13, 2024, 10:38:31 pm
content: There is not an easy solution for that. The amount of effort for working with a universal device like this would be comparable to just using native USB.Supporting DFU would require extensive communication protocol, so if main MCU can't support USB for some reason, the only real solution is a small dedicated USB MCU and a custom UART/I2C interface.There won't be an off the shelf device like this, since there is no real market for it.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 13, 2024, 10:44:08 pm
content: I don't get why you wouldn't want to implement it in the main MCU itself. It's the most flexible solution to implement the exact type of USB device you want. STM32F4 series do support USB, they require an external USB PHY though, but these are very cheap. The PHY just handles the low-level physical interface, the whole protocol controller is on the MCU. ST provides examples for implementing USB devices, you can also use a third-party lib like TinyUSB.There are of course many other MCUs with an embedded USB controller, many with the PHY integrated as well. (Note that I'm not sure what *you* mean by USB PHY here - it sounds as though you actually mean a USB controller. The PHY is the low-level interface part. A PHY itself is not a USB controller and doesn't do anything useful on its own.)There's a lot of stuff as far as USB bridges go, beyond USB-UART, if you're looking for that. Just have a look at FTDI's offering, it's rather large with devices implementing HID, or the classic parallel FIFO ones (FT245/FT232H/FT2232H/etc...). There are other vendors with similar solutions too. Be aware that this external "bridge" approach won't allow you to customize the USB interfaces in any way, apart from changing the USB VID/PID and a few other options. But you'll be stuck with whatever interfaces they provide (a vendor class using bulk transfers for the FTDI parallel FIFOs, a HID class for their HID devices, etc.)So for flexibility, the easiest path it to use a MCU with a USB controller and use that. As I said, the STM32F4 series that you use actually have a USB controller, they just require an external PHY, the controller is still on the MCU.Examples of such USB PHYs are the USB33xx series (Microchip). Easily available, cheap.

author: imacgreg
author_rank: Contributor
timestamp: January 13, 2024, 11:04:49 pm
content: Ok thanks guys.I think ataradov's description of "a small dedicated USB MCU and a custom UART/I2C interface" is closer to what I was asking for in my op. Something that I could design a small board around (I'm not expecting a drop-in COTS part) and add the USB connectivity without changing the main MCU hardware, aside from a uart/i2c connector.That aside, I am going to review the decision to not use the F4 USB. It makes a lot of sense. I have an F4 Nucleo with USB hardware (in addition to the STLINK USB). Would be silly to not give it a shot.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 13, 2024, 11:32:58 pm
content: Doing it all in the same MCU does make sense IMO, but you can of course consider using an additional MCU to implement your USB communication if you don't want to modify your existing hardware design.If USB FS is fine and you don't need HS, going for a RP2040 for the USB would be certainly an option: its price is in the same range as an external PHY like USB33xx required for the STM32F4, and you could offload a number of additional tasks to it.

author: langwadt
author_rank: Super Contributor
timestamp: January 13, 2024, 11:49:44 pm
content: Quote from: imacgreg on January 13, 2024, 11:04:49 pmafaict an stlink would be a COTS solution

author: PCB.Wiz
author_rank: Super Contributor
timestamp: January 14, 2024, 12:22:20 am
content: Quote from: imacgreg on January 13, 2024, 10:01:38 pmWCH have choices of HS-USB (TSSOP20) and FS-USB (down to MSSOP10)https://www.wch-ic.com/products/categories/46.html?pid=1#dataand STC have new MCU+USB parts, in TSSOP20 and SO16 packages, STC8H2K08U / STC8H8K64U, they have CDC examples.Quote from: imacgreg on January 13, 2024, 11:04:49 pmYou can run both ideas in parallel.Choose host HW that has USB resource, but start development using the off chip bridge.That lets SW focus on marketing features now, and later you can decide if the external cost is significant enough to pull in the USB side.

author: nigelwright7557
author_rank: Frequent Contributor
timestamp: January 14, 2024, 12:50:06 am
content: If you dont need the speed then using a bridge is fine.It took me quite a while to get a USB interface working with a PIC micro despite been given some software that did the basics.I had to get involved with MPLAB Harmony to set up USB.The the provided code had to be expanded for my own taks.

author: westfw
author_rank: Super Contributor
timestamp: January 14, 2024, 01:52:30 am
content: QuoteAre you aware that the FTDI chips (or at least some of them) have a utility for setting them up with custom vendor information?

author: coromonadalix
author_rank: Super Contributor
timestamp: January 14, 2024, 02:18:59 am
content: ah for sure ftdi is the king, for usb dev id's you have ftprog on their websitecypress too but no small usb interfaces lollBUT if you want to use your own dev id, you need to pay for it, and register it ....you can not create one out of fun, it must be registeredat my company we pay for mac address "numbering" we have reserved over "1 million mac numbers" and for usb dev id's since we ship internationally, we design and build systems

author: JPortici
author_rank: Super Contributor
timestamp: January 14, 2024, 04:01:33 am
content: Quote from: imacgreg on January 13, 2024, 10:01:38 pmwhy? sure, a good reason would be to avoid dealing with USB-CDC completely and stay in the comfort zone of UART (a very good reason IMHO) and that's why all my usb products are either HID or Vendor - with Microsoft special descriptor so i don't need to provide a driver.Anyway, can't you change VID/PID in the FTDI chips? you sure can in microchip'sbut changing VID/PID means that you need to pay the USB-IF tax for it