PWM Driver

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
dflogeras
Posts: 232
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

PWM Driver

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: PWM Driver

Post by Giovanni »

3.0 already allows to enable/disable callbacks at runtime without stopping the driver.

Giovanni
dflogeras
Posts: 232
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: PWM Driver

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: PWM Driver

Post by Giovanni »

Good point, I will add the I-class functions too. You may call the low level in the meanwhile.

Giovanni
Post Reply