Skip to main content
Killstreet30
Associate III
January 16, 2023
Solved

STM32 IDE change prescaler and counter values using code only.

Hi,

I wanted to know how can we change the values of prescaler and counter period for a timer in STM32 using the code and not the UI. Please help.

This topic has been closed for replies.
gbm
gbmBest answer
Super User
January 16, 2023

Read the description of timer in your MCU's Reference Manual. No magic, these operations are merely C assignments like TIMx->PSC = x;

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

2 replies

gbm
gbmBest answer
Super User
January 16, 2023

Read the description of timer in your MCU's Reference Manual. No magic, these operations are merely C assignments like TIMx->PSC = x;

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Killstreet30
Associate III
January 16, 2023

Thank you!