Hello,
I confirm @Simon.T saying, that's due to the system tick timer.
You can test that by modifying the system tick interrupt frequency in stm32c0xx_hal.c. This is the default value i.e. 1kHz:
HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT; /* 1KHz */
The different definitions are available in stm32c0xx_hal.h:
typedef enum
{
HAL_TICK_FREQ_10HZ = 100U,
HAL_TICK_FREQ_100HZ = 10U,
HAL_TICK_FREQ_1KHZ = 1U,
HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ
} HAL_TickFreqTypeDef;
So in your case select 100Hz or 10Hz:
HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_100HZ; /* 100Hz */
Hope that helps.
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.