First consider price. In October of 2023 on AliExpress I could order a lot of 5 STM32F103 "blue pill" boards for $5.43 and 3.44 shipping charges. $8.87 in US dollars. Round this up to $2 each. Dirt cheap! I already have 20 of these on hand. You will also want a ST-Link v2. I see these (believe it or not) on AliExpress for $0.99 with free shipping. I recommend buying a handfull of the STM32F103 devices and at leas two ST-Link devices so you have spares.
The Pi Pico with the RP2040 is a bit more expensive, but still ridiculously inexpensive. You can buy them right now (October, 2023) on Adafruit for $4. I suggest buying three since you will be paying shipping (perhaps more). This gives you one or more as a spare, and you can configure the other with picoprobe firmware which provides openocd access as well as a USB to serial interface on the same device. Here is my setup:
Either way the money is about the same (on the order of $20) to get started.Note that with the STM32, the ST-Link is pretty much essential (although you could install a DFU boot loader and work with that). With the RP2040, a second device acting as a pico-probe is a luxury, you can get by nicely with nothing more than a single device and a USB cable.
In short, the printed documentation for both is available and excellent.
For the STM32F103, you have 3 options, one is terrible, the others are pretty good.
I give the link to libmaple as one project that uses the terrible USB source code distributed by ST. This awful code is part of "Cube" or whatever they call it. It is notorious for being one of the worst code disasters available anywhere. It does seem to work, so there is that for it.The Papoon_usb is for the STM32F103 only and is nice code, but written in C++. I avoid C++ like the unclean plague, but I am willing to at least look at the code, but will probably refuse to compile or run it. His notes and comments are very much worth reading.
And again we have TinyUSB. All plain C code. And having the same code for the RP2040 and the STM32 means that what you learn for one carries over to the other.
The RP2040 has 4096 bytes of dual ported SRAM set aside for USB (64 buffers of 64 bytes).
The STM32 has 512 bytes of RAM set aside for USB (8 buffers of 64 bytes)
The RP2040 uses IRQ5 for USB ctrl interrupts.
The STM32F103 is a "performance line" part in the STM32F1 lineup and provides
3 interrupts for USB.
We have "hp" on IRQ 19, "lp" on IRQ 20 and "wk" on IRQ42.
See elsewhere for an explanation of what these are.
Both provide an ARM NVIC controller.
A general comparison of the RP2040 and the STM32F103 is in order. Code is loaded into the RP2040 over USB by copying files to the mass storage device set up by the bootrom. Code for the STM32 is loaded using the ST-Link over the SWD lines. I typically use a command like this in my Makefile:
flash: blink.elf openocd $(OCDCFG) -c "program blink.elf verify reset exit"The RP2040 has a dual core ARM Cortex M0+ running at 133 Mhz with 264k of ram and 2M of flash.
Tom's Computer Info / tom@mmto.org