Reconfigure timer usage at run-time? Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
rreignier
Posts: 23
Joined: Sat Apr 15, 2017 11:49 pm
Has thanked: 8 times
Been thanked: 4 times

Reconfigure timer usage at run-time?

Post by rreignier »

Hi,

I would like to be able to change the usage of a timer at run-time between GPT and QEI (encoder). Both are not used at the same time.
I know that QEI is not (yet?) part of ChibiOS HAL, only ChibiOS-Contrib, but as a general question, is it possible to change the usage of a timer at run-time?
My issue for now is that if I enable both GPT and QEI on the same timer in mcuconf.h, I get the error:

Code: Select all

"GPTD4 requires TIM4 but the timer is already used"


So, do I have to comment out this check in the ChibiOS source code or is there a workaround for that issue?
nikiwaibel
Posts: 29
Joined: Sat Mar 17, 2018 2:51 pm
Has thanked: 8 times
Been thanked: 15 times

Re: Reconfigure timer usage at run-time?

Post by nikiwaibel »

as of my knowledge: timers are defined/assigned statically to either the
  • GPT (gerneral purpose timer),
  • PWM or
  • ICU (input capute unit - to measure duty cycles)
driver; and that assignment can't be changed / dynamically assigned during runtime.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Reconfigure timer usage at run-time?

Post by Giovanni »

Correct, timers assignment cannot be changed dynamically.

Giovanni
rreignier
Posts: 23
Joined: Sat Apr 15, 2017 11:49 pm
Has thanked: 8 times
Been thanked: 4 times

Re: Reconfigure timer usage at run-time?

Post by rreignier »

Ok, thank you.

I will try to use another timer for GPT. A basic timer like Timer6.
Post Reply