Is it allowed to change timer PSC after gptStart?

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
kjwiik
Posts: 4
Joined: Fri Oct 07, 2016 2:45 pm
Has thanked: 1 time

Is it allowed to change timer PSC after gptStart?

Post by kjwiik »

I need to generate a wide range of frequencies dynamically and therefore adjusting both ARR and PSC on the fly is necessary, something like this:

Code: Select all

gptChangeInterval(gptp, arr);
gptp->tim->PSC  = psc;


RM says PSC can be changed on the fly but is there something in ChibiOS that makes this a bad idea?

Thanks,
Kaj
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Is it allowed to change timer PSC after gptStart?

Post by Giovanni »

Hi,

The driver is very close to hardware so you can do that. Of course timings are up to you in that case.

Giovanni
kjwiik
Posts: 4
Joined: Fri Oct 07, 2016 2:45 pm
Has thanked: 1 time

Re: Is it allowed to change timer PSC after gptStart?

Post by kjwiik »

Excellent, many thanks!

Kaj
Post Reply