Page 1 of 1

Reconfigure timer usage at run-time?

Posted: Mon Feb 10, 2020 11:16 pm
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?

Re: Reconfigure timer usage at run-time?

Posted: Tue Feb 11, 2020 2:07 am
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.

Re: Reconfigure timer usage at run-time?

Posted: Tue Feb 11, 2020 5:30 am
by Giovanni
Correct, timers assignment cannot be changed dynamically.

Giovanni

Re: Reconfigure timer usage at run-time?

Posted: Tue Feb 11, 2020 9:37 am
by rreignier
Ok, thank you.

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