Trying to adjust the PWM period value using the macro
__HAL_TIM_SET_COMPARE(&htim4,TIM_CHANNEL_3,299);
but it does not work.
However the macro
__HAL_TIM_SET_AUTORELOAD(&htim4, 599);
works fine.
why the __HAL_TIM_SET_COMPARE
does not work ?.
The board I am using is NUCLEO-F401RE with CUBE-MX generated project on Truestudio.
I had similar issues with this macro, and would opt instead for:
htim4.Instance->CCR3=299;
Supposing you want to set the capture and compare register of channel three for htim4
to 299 to modify your PWM duty cycle.