Skip to main content
Killstreet30
Associate III
Jan 16, 2023 5:13 AM UTC
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
Jan 16, 2023 7:29 AM UTC

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
Jan 16, 2023 7:29 AM UTC

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
Jan 16, 2023 7:33 AM UTC

Thank you!