how to turn off both complementary pwm at the same time
I am using STM32F4 to drive a 3 phase BLDC motor and i'm using TIM1 peripheral to
generate 6-step PWM(complementary pwm) but when i change the configuration and i disable 1 channel it takes some time to go low which causing problems (you can check the photos in the links below )
also here is my configuration:
TIM1->PSC=0;
TIM1->ARR=800;
TIM1->CCR1=400;
TIM1->CCR2=400;
TIM1->CCR3=400;
TIM1->CCMR1 |= TIM_CCMR1_OC1PE | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC2PE | TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2;
TIM1->CCMR2 |= TIM_CCMR2_OC3PE | TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_2 ;
TIM1->CCER |= TIM_CCER_CC1E | TIM_CCER_CC1NE | TIM_CCER_CC2E | TIM_CCER_CC2NE | TIM_CCER_CC3E | TIM_CCER_CC3NE ;//!CH and CH
TIM1->CR2 |= TIM_CR2_OIS1N | TIM_CR2_OIS2N | TIM_CR2_OIS3N | TIM_CR2_CCPC ;
TIM1->BDTR |= TIM_BDTR_MOE | TIM_BDTR_OSSR;
TIM1->CR1 |= TIM_CR1_DIR; // DOWN COUNTER
TIM1->EGR |= TIM_EGR_UG;
TIM1->CR1 |= TIM_CR1_CEN;
and this the code to change the config:
TIM1->EGR |= TIM_EGR_UG;
TIM1->CCER &=~ ( TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC3NE);
TIM1->CCER |= TIM_CCER_CC1NE | TIM_CCER_CC1E; //AH + !AH
TIM1->CCER |= TIM_CCER_CC2NE;//BL
is there a way to turn off both complementary pwm at the same time
