I’ve been wanting to work with the STM32F030F4P6 microcontroller for a few days now.
However, I’ve encountered a strange problem that hasn’t completely hindered my project progress, but I find it odd why it’s happening.
To summarize, I want to work with the timers of this microcontroller, but each timer has a specific technical issue.
For example, Timer 1 works with PWM on some channels, but on some others channel, it gives a very low voltage output on oscilloscope. Even on the channels where it works, some allow adjusting the duty cycle and changing it during the microcontroller’s operation, but on the side channel, like 2, I can’t adjust the duty cycle it no matter what I do.
And these issues I mentioned aren’t limited to Timer 1; each timer has something that doesn’t work properly. For instance, the interrupt callback function of the timers works one in between.
I’m pretty sure that the CubeMX settings are correct, and I’ve thoroughly checked my code. Here are some code samples:
__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_2,50);
This is to set the duty cycle of Timer 1, Channel 2 to 50 (with a period of 100).
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { }
This is the callback function that I think should be called with each timer interrupt.