Could you look at TIM2 registers and post values here? especially the prescaler and ARR.
Giovanni
GPT set frequency
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
-
fastlink30
- Posts: 42
- Joined: Tue Aug 12, 2014 1:25 pm
Re: GPT set frequency
attached register with all the values.
why tim2? gpt use tim8
if for irq priority i have already changed value for gpt8 (set to 11), but nothing change
why tim2? gpt use tim8
if for irq priority i have already changed value for gpt8 (set to 11), but nothing change
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: GPT set frequency
OK found the error....
I think you misunderstood the meaning of the frequency field in the configuration structure. It is not the frequency of the timer but the frequency driven into the timer counter (it is the resolution of the timer).
The final frequency, more appropriately the period, is what you pass to gptStartContinuous(), you set zero there and it is taken as 65536.
For example try setting the resolution to 1000000 (1uS) then pass to gptStartContinuous() the period you need in microseconds, for example 50 (20kHz).
Note that the PWM and ICU drivers work the same way.
It was obvious and in full sight yet perfectly invisible...
Giovanni
I think you misunderstood the meaning of the frequency field in the configuration structure. It is not the frequency of the timer but the frequency driven into the timer counter (it is the resolution of the timer).
The final frequency, more appropriately the period, is what you pass to gptStartContinuous(), you set zero there and it is taken as 65536.
For example try setting the resolution to 1000000 (1uS) then pass to gptStartContinuous() the period you need in microseconds, for example 50 (20kHz).
Note that the PWM and ICU drivers work the same way.
It was obvious and in full sight yet perfectly invisible...
Giovanni
-
fastlink30
- Posts: 42
- Joined: Tue Aug 12, 2014 1:25 pm