2016-10-09 04:11 PM
Hi,
I am trying to get complimentary output working with the same polarity on both the OCx and OCxN. I have successfully done this with TIM_OCPolarity_High, and TIM_OCNPolarity_Low. The next step is to be able to disable and re-enable either the OCx or OCxN outputs. I am able to set up everything as I want, with the desired polarity on the desired outputs. However when I disable the OCx output using TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Disable);and then re-enable it usingTIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Enable); the OCxN output polarity reverts back to TIM_OCNPolarity_High. I am currently using an STM32F103RBT6 Nucleo board with ST Link debugger.I have checked the CCER register and the OCxN polarity bit is high (=1), but the output is reversed.If I disable and re-enable the OCxN output, it retains the correct polarity.Very confused, any help would be great, thanks in advanceRob2016-10-10 02:43 AM
Hi minthemerciless,
In this case, you should the commutation feature in Timer peripheral. To get more in details about it you can refer to the section 6-PWM generation in STM32F1xx reference manual.There is the new application note about TIMERS which is . The commutation feature is described there and is used in the firmware example ''NpulseWave_TIM_Sync'' that you find in the relevant firmware package -Hannibal-