I've been doing some research over the last few days into implementing usb communication protocol on the stm32. I know that the stm32 has dedicated pins for USB communication, however I still see a lot of designs using a UART-USB bridge despite the existence of these pins. I haven't been able to find much in the way of what the advantages/disadvantages of using a UART-USB bridge is vs just using the USB pins directly. If it makes a difference, for my application I am planning just to use the USB port for programming after the initial bootloader is uploaded, however I am considering making an GUI that goes with this circuit at some point. For the design I am using a STM32F103RCT6
1 Answer
With a USB UART bridge, you can see the virtual COM port in your PC and communicate with it, even if there is no firmware on MCU.
Also the MCU then does not need firmware that supports USB in any way and can simply communicate with UART.
Which means that since the F103 does not support DFU with factory bootloader, you are forced to write your own firmware and/or custom bootloader that supports USB enough to be able to update the firmware portion.
The factory bootloader does support UART so with a USB to UART chip, you don't need any special custom firmware or bootloader, as you can simply boot (somehow, maybe with a button) into factory bootloader and program the MCU, and you are never locked out of the system.
However, using the MCU USB interface allows you to present itself as any device you want, such as keyboard, mouse or mass storage, etc, which isn't possible through the USB UART chip.
So it really depends what you want to do. If you don't use the USB for anything else than uploading new firmware, then you need to develop software yourself that you trust has no bugs when you upload the firmware. And then you need to implement the PC side too if you use your own custom protocol. This is something you don't need at all if you put a hardware USB UART chip there.
The other option is also not to use the F103. If you use an STM32 which supports USB in the factory bootloader, then you don't need the USB UART chip and can upload with existing GUI tools.
-
\$\begingroup\$ Thanks so much, this definitely answers my question. Given this, I'll go with USB-UART as it will mainly be for updating firmware so I'd rather save the memory space. \$\endgroup\$ Commented Jan 9 at 0:42