Skip to main content
Manny12
Associate II
October 28, 2022
Question

DFU and USART on USB

Sorry about the dumb question.

Is it possible to have DFU and USART on the same USB port on a custom board?

I just want to upload firmware via USB and have the ability to receive sensor data output via UART using a virtual com port.

Two different things, on the same USB connector, not at the same time.

I know I cannot just wire USART to USB. Some online posts say you need an FTD chip, such as the ftd232, included on the board's design.

Is that the right approach?, basically include an ftd232 on the board, wire it to the USART on the STM32 chip, and use that as a virtual com port and to program the MCU.

Is there a better approach?

Thanks a lot

This topic has been closed for replies.

6 replies

Tesla DeLorean
Guru
October 28, 2022

Not as a "USART" but a Virtual CDC / VCP USB Device implementation.

Which STM32 part? There like a thousand of unavailable ones at this point..

A single device could support multiple classes, with software/descriptors, and sufficient end-points. An MSC can support multiple Logical Units (LUNS)

For other "single cable" type devices, there are USB Hub chips where you could support multiple USB Devices on your PCB. There are also DUAL and QUAD CDC/VCP parts.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Manny12
Manny12Author
Associate II
October 28, 2022

Sorry,, the STM32F401C is what is on my mind.

They have some in stock from where I order my PCBs

And yes, the stock is very bad, I noticed, I wonder what will happen in the near future with consumer electronics if things keep staying the same.

Regarding your answer, you did point me in the right direction. I appreciate it, thanks !

MM..1
Super User
October 28, 2022

401 have USB DFU system bootloader, but you will need hw or sw switching method between DFU and APP mode. (app as CDC) No ftdi required, only usb con and cable

Manny12
Manny12Author
Associate II
October 28, 2022

Yes, the datasheet says it does have DFU, page 18. I still cannot make my test board work with DFU properly, but that's for another post.

How do you switch modes in hw? I can imagine how with software+hw (using interrupts from a momentary switch), is that what you mean, or there is an option just with a jumper or switch?

gbm
Super User
October 29, 2022

BOOT0 pin - essential part of any STM32 chip operation. In boot mode the MCU will act as DFU by itself, you may implement USB CDC (VCOM) in your app firmware. Yo may also invoke the built-in bootloader from your app.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
MM..1
Super User
October 29, 2022

Read AN2606 and for sw vs hw you need method to activate DFU

SW is for example menu on display with jump to bootloader call.

HW is for example jumper , that changes BOOT0 high for power on reset.