PWM dutycycle is not working as expected
Posted: Mon Jan 06, 2020 8:35 pm
Hi, I've been playing around with my nucleo f446ze board for quite some time.. I came across a weird problem, while setting my dutycycle to 75% the on-board led behaves as if its set at 25% dutycycle (its dimmer)
And when I set my dutycycle to 25% the led behaves like its set at 75% dutycycle ( its brighter)
PWM duty cycle 25% - LED brightness 75%
PWM duty cycle 75% - LED brightness 25%
I've listed my config below.. Can you please explain whats is wrong or is it supposed to work like this.
Thanks in Advance
And when I set my dutycycle to 25% the led behaves like its set at 75% dutycycle ( its brighter)
PWM duty cycle 25% - LED brightness 75%
PWM duty cycle 75% - LED brightness 25%
I've listed my config below.. Can you please explain whats is wrong or is it supposed to work like this.
Code: Select all
static PWMConfig pwmcfg = {
100000,
1000,
pwmpcb,
{
{PWM_OUTPUT_ACTIVE_HIGH, pwmc1cb},
{PWM_OUTPUT_DISABLED, NULL},
{PWM_OUTPUT_DISABLED, NULL},
{PWM_OUTPUT_DISABLED, NULL}
},
pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500));
Thanks in Advance