Is it allowed to change timer PSC after gptStart?

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

Is it allowed to change timer PSC after gptStart?

Postby kjwiik » Sat Oct 05, 2019 1:23 pm

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: 12179
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 571 times
Been thanked: 488 times
Contact:

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

Postby Giovanni » Sat Oct 05, 2019 1:34 pm

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?

Postby kjwiik » Sat Oct 05, 2019 4:37 pm

Excellent, many thanks!

Kaj


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 1 guest