A variety of projects include source code for F411 and/or F103 chips. (I will begin abbreviating STM32F411 as simply "F411"). All of the projects I have looked at so far include USB libraries written by ST. My study of this code so far indicates that this code was written in what I can only describe as an odd and difficult to read style. And the code I have seen follows an absurd but all too common rule of placing include files in some far away isolated directory. This is both frustrating and a large part of what motivates this project.
There are any number of online tutorials and articles. A person rapidly finds themself immersed in a sea of USB jargon, and it will be a part of my purpose to sort out and explain all of this.
USB is much like a little network, but a network written on the planet Mars. So USB has layers, upper levels handling USB states and lower levels dealing with specific hardware. This is additionally complicated by the fact that USB devices can be "hot plugged", i.e. unplugged at any time.
It is an interesting web writeup on USB and microcontrollers.
He works with the STM32F103 "blue pill" along with LibOpenCM3.
But trouble starts soon. He uses Visual Studio Code along with PlatformIO as an extension
(whatever the heck it is) and writes C++ code (never the right thing for an embedded system).
The "Bare Metal" blog works up code for an STM32L052, so it is hard to say how relevant this will be, but his code looks clean and straightforward. The STM32L052 is an ultra low power part (note the "L" in the middle of the part number). It has 32K of flash and 8K of ram and runs at 32 Mhz.
"USB Complete", by Jan Axelson -- Fourth Edition, 2009, 504 pages.
Tom's Computer Info / [email protected]