How to create a USB CDC device. (I'm using stm32f103c8 black pill board) and I want to read the data through USB in my raspberry pi as a serial port.

I am using a black pill to read RFID-rf522 to read a tag (SPI) and send it to raspberry pi through a USB (using DM and DP pins).

Quick responses are welcomed.

  • It depends on what the core provides. If it's like others, then Serial.begin(115200); or maybe USBSerial.begin(115200); will do it. Read the manual for the STM32F1 core on the website for that core.
    – Majenko
    Feb 23, 2020 at 20:27
  • Could it be that you might be better off just to use the STMicro code for what you are doing?
    – st2000
    Feb 23, 2020 at 20:30
  • if you use the core by STM select USB support in Tools menu
    – Juraj
    Feb 23, 2020 at 20:38

1 Answer 1


You can use the one provided by generating it with STMCubeMx. This is going beyond arduino though. But it is highly feasible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.