Problem with hardware serial STM32 F103C8T6 Bluepill

According to the STM Errata for the F103C8T6 :
STM32F10xx8 STM32F10xxB Errata there is a problem with USART and SPI under some circumstances. Check out Section 2.3 GPIO.

Some people experienced problems with counterfeit chips, see comments: Stackexchange Bluepill

Which board did you select?

Some more clues maybe here: Arduino_Core_STM32 Wiki

Maybe try the Arduino IDE, as some have indicated that plattform.io behaves somewhat differently: STM32 multiple serial

This sounds like your problem: DanLL post