ESP32 mcPWM

I have a test setup to dim a light.
the hardware conssist of a ZCD connected to GPIO22
a vom1271 gate connected to GPIO23
The vom controlles 2 mosfets back to back.

i have the the code working, only the light is flickering and the pwm signal isn’t stable.
what can i do to get a more stable pwm signal.

below is the code
to see what is happening see this video, you see on the lower part of the scope the ZCD, the upper part is the PWM signal, you see the pwm signal isn’t stable and below the scope you sometimes see the light flickering.

Youtube clip of flickering and scope image

#include "driver/mcpwm.h"

#define GPIO_SYNC0_IN 23       //pin for the external interrupt (Input with Pullup)                         
#define MOSFET 22          //pin to trigger the MOSFET (Output) pin22

void setup() {
  // put your setup code here, to run once:
  mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM0A, MOSFET);


  mcpwm_pin_config_t pin_config; 
    pin_config.mcpwm_sync0_in_num  = GPIO_SYNC0_IN;
      
  mcpwm_config_t pwm_config;
    pwm_config.frequency = 60;    //frequency = 110Hz
    pwm_config.cmpr_a = 100;       //duty cycle of PWMxA = 60.0%
    pwm_config.counter_mode = MCPWM_UP_COUNTER;
    pwm_config.duty_mode = MCPWM_DUTY_MODE_0;
    
  mcpwm_set_pin(MCPWM_UNIT_0, &pin_config);
  mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_0, &pwm_config);   //Configure PWM0A & PWM0B with above settings
  mcpwm_set_duty_type(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_A, MCPWM_DUTY_MODE_0);
  mcpwm_start(MCPWM_UNIT_0, MCPWM_TIMER_0);
  mcpwm_sync_enable(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_SELECT_SYNC0, 0);

  mcpwm_set_duty(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_A,25);
}

void loop() {

}

Hey,
seems you never got a reply. Let´s see if it matters half a year later.

While I´m still scratching the surface:
At ESP32 PWM with Arduino IDE (Analog Output) | Random Nerd Tutorials they talk about “PWM signal frequency. For an LED, a frequency of 5000 Hz is fine to use.”

At Espressif they talk about PWM for LEDs and MCPWM (Motor Control PWM).
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/mcpwm.html

Guess you´re using the wrong part of the API and the wrong frequency. (60 or 110 instead of 5000Hz)

Regards
G.