Help setting the comparator for the timer brake. Internal connection between the comp and TIM1 with complementary outputs
Hi, I'm setting up a custom board with STM32G431CBT6 to control a 6-step bldc motor. I want to use comparators to protect against overcurrent.
My problem I configured the bkin input and comparators. the bkin input works, the comparator also works separately (puts out an external signal).
But the PWM does not stop when the comparator is working. I can see the active output of the comparator, but it has no effect on the pwm.
I created a simple program to test this, no motor control, just complementary PWM.
I want it to work at the hardware level. Can someone tell me what I'm doing wrong?
I add screenshots and code.
MX_GPIO_Init();
MX_TIM1_Init();
MX_COMP1_Init();
MX_DAC1_Init();
/* USER CODE BEGIN 2 */
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start( &htim1, TIM_CHANNEL_1 );
HAL_COMP_Start(&hcomp1);
HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_2, DAC_ALIGN_12B_R, 4000);
HAL_DAC_Start(&hdac1, DAC1_CHANNEL_2);
HAL_DAC_SetValue(&hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 4000);
HAL_DAC_Start(&hdac1, DAC1_CHANNEL_1);


