Why Auto-Generate code with cubeMX give a try to program your application using ST's Hardware Abstraction Layer (HAL). This reposetory contains program examples of TIMERS, PWM, CAN, RTC, LOW POWER MODES and Clock Configuration of STM32. These Examples are from udemy course Mastering Microcontrollers 2.
STMCubeIDE
NUCLEO-F401RE
STM32F103C8-BluePill