Page 1 of 1

PWM Driver

Posted: Wed Feb 04, 2015 3:53 pm
by dflogeras
Hi,

I'm using PWM on a STM32L1 to generate 38kHz infrared pulse-trains. I use the PWM callback to determine how many pulses have been output, then disable the channel for a cool-down period and set a GPT timer for a few hundred uS to re-enable the channel.

What I am noticing, and I think it is by design, is that when a PWM channel is disabled, that seems to only mean that the output pin (controlled by the DIER register) is disabled. It seems that my channel callback is still being called even when the channel is disabled.

I saw a post that there may be an addition to the 3.2 release to give users the option to disable callbacks. Do I have any options in the current 2.6 series? The only thing I can determine is turning the whole PWM driver off globally (well, also having logic in my callback to determine if it should act or not).

Thanks,
Dave

Re: PWM Driver

Posted: Wed Feb 04, 2015 3:56 pm
by Giovanni
3.0 already allows to enable/disable callbacks at runtime without stopping the driver.

Giovanni

Re: PWM Driver

Posted: Wed Feb 04, 2015 4:07 pm
by dflogeras
Ahh, I guess it is time to think about porting to 3.0.

I notice there aren't I-Class functions for enabling/disabling the callbacks in the API. Is this planned? Or am I designing poorly by wanting to do this from within a GPT callback context?

Dave

Re: PWM Driver

Posted: Wed Feb 04, 2015 4:37 pm
by Giovanni
Good point, I will add the I-class functions too. You may call the low level in the meanwhile.

Giovanni