2020-03-23 12:50 AM
Code found in the main.c and figure of the issue seen in PWM_scope_NOK.png.
2020-03-23 01:27 AM
/* Infinite loop */
while (1)
{
for (int j=0; j<2; j++)
{
TIM3->CCR1 = duty_values[j];
}
}
Your code doesn't wait for an update or anything, it just continuously changes the duty cycle between two values.
If you want to alternate between 50% and 78%, you'll need to change CCR1 in a timer update interrupt, or something similar.