Trouble getting USART working on STM32 (stm32f103c8t6)
Enable the peripherals in RCC first, both the UART and the I/O port. (Port A if using the default pin mapping.) Until that point the peripherals are completely disabled, including their register interface, writes to USART1-&gt;CR1 etc have no effect. This line should go to the top:

RCC-&gt;APB2ENR |= RCC_APB2ENR_USART1EN | RCC_APB2ENR_IOPAEN;


Configure GPIO alternate output

All pins are in input mode at reset. To enable the output signal on the TX pin, you should set PA9 to


Output mode, (max speed 2 MHz)
Alternate function output push-pull


See the description of GPIOA-&gt;CRL/GPIOA-&gt;CRH in the reference manual for the bit settings.