Page 2 of 2

Re: GPT set frequency

Posted: Sat Dec 19, 2015 9:16 pm
by Giovanni
Could you look at TIM2 registers and post values here? especially the prescaler and ARR.

Giovanni

Re: GPT set frequency

Posted: Sun Dec 20, 2015 8:56 am
by fastlink30
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
tim8-gpt.png
tim8-gpt.png (4.64 KiB) Viewed 3290 times

tim2-pwm.png
tim2-pwm.png (4.61 KiB) Viewed 3290 times

Re: GPT set frequency

Posted: Sun Dec 20, 2015 9:09 am
by Giovanni
Sorry :) the values of your timer of course.

Giovanni

Re: GPT set frequency

Posted: Sun Dec 20, 2015 9:17 am
by Giovanni
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

Re: GPT set frequency

Posted: Sun Dec 20, 2015 9:32 am
by fastlink30
ahaaa :D
now it's clear! :roll:

sorry giovanni for your time & patience

thank you