[SOLVED] Changing PWM from an interrupt.

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

Moderator: RoccoMarco

Post Reply
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

[SOLVED] Changing PWM from an interrupt.

Post by rew »

Hi,

I have an interrupt where I suddenly "know" the new value for a PWM module.
I tried:

Code: Select all

 pwmEnableChannel(&PWMD3, chan, data);
but that ends up in an assert that there is a syslock problem.
I now use:

Code: Select all

    PWMD3.tim->CCR[chan] = data;
Saves a few subroutine calls as well I guess. :-)

Is there anything I can do to cleanup the code? Do I need to twist myself to pass the new value to the main program and then call pwmEnableChannel?

Solved:

Code: Select all

    pwmEnableChannelI (&PWMD3, baddr&3, d);
Post Reply