If your STM32 can speak USB, then you should use it. However, the USB protocol is very complex, so it is likely that you will be using ST's libraries for this. (The
USB MIDI protocol itself is rather simple.)
Consider using libraries that have built-in USB MIDI support, i.e., Arduino (this works on chips with built-in USB support, e.g., ATmega32U4-based boards or Teensy; I don't know if there is full Arduino support for your STM32).
The FTDI chips do not speak USB MIDI (USB serial is a different protocol). The only external USB/MIDI chip is the CH345, which I cannot recommend because it is too buggy.