Seems like a usage error. Your sketch may be written for the STM32Duino core (called “stm32” in PIO) and not the maple core by Roger Clark. The maple
board uses core: "maple"
while bluepill_f103c8
defaults to stm32
:
The SPI class in the Maple core is instantiated by using only the SPI number from 1 to 3. The slave select / NSS pin is then given in the beginTransaction()
call.
The STM32Duino core fits the code you have shown with the 4 pins in the consturctor.
So it’s very clear that your sketch was written against STM32Duino/STM32 core and not maple, so using board = bluepill_f103c8
is correct for that. Now to the question
The STM32Duino doesn’t activate the USB CDC interface by default. See Difficulty with getting USB serial [USB CDC] working - #6 by maxgerhardt for the needed flags.
I don’t however know if it’s possible to have the USB DFU bootloader from the Maple core AND the USB CDC from the STM32Duino core running… You might still try to pre-flash the Maple bootlader, add upload_protocol = dfu
to the platformio.ini
and then upload a STM32Duino firmware.