Arduino DUE PWM Overflow

I'm currently using an Arduino DUE. I'm currently using Arduino DUE, and I'd like to use overflow interrupt instead of compare match, but I don't know how to do it.
I also have a program that reads analog signals and converts them to AD signals. Can anyone tell me how to do overflow interrupt and how to get to the interrupt destination after the overflow flag is generated?
Also, is it possible to synchronize the timer counter with the PWM counter?
Thank you in advance.

Share your code please

This is the program I'm currently writing; I've commented out the ADC part because I'm not sure about it. I've also commented out the parts of the program that I don't think are necessary right now. I've been referring to various websites and datasheets, but I can't understand what they mean and I can't achieve what I'm thinking.
Thank you very much for your help.

For additional information, I would like to do a PWM overflow interrupt with a 5kHz cycle.

The ADC handler part is programmed from the characteristics of the current sensor I use.

Also, since serial printing takes a long time to process, I thought of storing the values in an appropriate structure and outputting the values only once at a time.

//volatile uint32_t lastConversion;
volatile boolean Flag;

const int VOL_PIN = A8;

int i=0 ;
double average = 0 ;
double average1 = 0 ;


    
    float value;
    float volt;
    float current;


void setup(){
  
pinMode(LED_BUILTIN, OUTPUT);

   tc_setup();
   pwm_setup();
  //adc_setup();
  interrupt_setup();

}




/*************  Timer Counter 0 Channel 2 to generate PWM pulses thru TIOA2  ************/
void tc_setup() {

  PMC->PMC_PCER0 |= PMC_PCER0_PID29;                      // TC2 power ON : Timer Counter 0 channel 2 IS TC2
  TC0->TC_CHANNEL[2].TC_CMR = TC_CMR_TCCLKS_TIMER_CLOCK2  // MCK/8, clk on rising edge
                              | TC_CMR_WAVE               // Waveform mode
                              | TC_CMR_WAVSEL_UP_RC        // UP mode with automatic trigger on RC Compare
                              | TC_CMR_ACPA_CLEAR          // Clear TIOA2 on RA compare match
                              | TC_CMR_ACPC_SET;           // Set TIOA2 on RC compare match


  //TC0->TC_CHANNEL[2].TC_RC = 238;  //<*********************  Frequency = (Mck/8)/TC_RC  Hz = 44.117 Hz
  //TC0->TC_CHANNEL[2].TC_RA = 40;  //<********************   Any Duty cycle in between 1 and 874
    
    
    TC0->TC_CHANNEL[2].TC_CCR = TC_CCR_SWTRG | TC_CCR_CLKEN; // Software trigger TC2 counter and enable
  
}


void pwm_setup(){
     
int32_t mask_PWM_pin = digitalPinToBitMask(7);

REG_PMC_PCER1 = 1<<4; // activate clock for PWM controller 
REG_PIOC_PDR |= mask_PWM_pin; // activate peripheral functions for pin (disables all PIO functionality) 
REG_PIOC_ABSR |= mask_PWM_pin; // choose peripheral option B
REG_PWM_CLK = 0; // choose clock rate, 0 → full MCLK as reference 84MHz 
REG_PWM_CMR6 = 0<<9; // select clock and polarity for PWM channel (pin7) → (CPOL = 0) 
REG_PWM_CPRD6 = 8; // initialize PWM period → T = value/84MHz (value: up to 16bit), value=8 → 10.5MHzPWM
REG_PWM_CDTY6 = 4; // initialize duty cycle, REG_PWM_CPRD6 / value = duty cycle, for 8/4 = 50% 
REG_PWM_ENA = 1<<6; // enable PWM on PWM channel (pin 7 = PWML6)


}


void interrupt_setup(){
 
  NVIC_EnableIRQ(TC2_IRQn);  // TC2 NVIC enable
  TC0->TC_CHANNEL[2].TC_IER = TC_IER_COVFS ;              // Interruption enable on TC_CV overflow ( TC_CV = 0xFFFFFFFF)

/*
 // PIO_IMR = PIO_IER
  PIOA->PIO_IER = PIO_PA12;  
  PIOA->PIO_IMR = PIO_PA12;  //PIO Interrupt Mask Register
  
  // enable PIO CLK

  //  PIO_AIMER -> additional interrupt
  PIOA->PIO_AIMER = PIO_PA12;     //AIMER Additional interrupt Modes Enable Register
  PIOA->PIO_AIMMR = PIO_PA12;     //AIMER Additional interrupt Modes Mask Register

  // PIO_ESR -> rising edge
  PIOA->PIO_ESR = PIO_PA12;       //PIO_ESR (Edge Select Register)
  
  // PIO_REHLSR -> rising edge
  PIOA->PIO_REHLSR = PIO_PA12; 
*/
}


/*************  Configure ADC function  *******************/
/*void adc_setup() {

  PMC->PMC_PCER1 |= PMC_PCER1_PID37;                    // ADC power on
  ADC->ADC_CR = ADC_CR_SWRST;                           // Reset ADC
  ADC->ADC_MR |=  ADC_MR_TRGEN_EN                       // Hardware trigger select
                  | ADC_MR_TRGSEL_ADC_TRIG3             // Trigger by TIOA2
                  | ADC_MR_PRESCAL(1);
  ADC->ADC_ACR = ADC_ACR_IBCTL(0b01);                   // For frequencies > 500 KHz

  ADC->ADC_CHER = ADC_CHER_CH7;                        // Enable ADC CH7 = A0
  ADC->ADC_IER = ADC_IER_EOC7;                         // Interrupt on End of conversion
  NVIC_EnableIRQ(ADC_IRQn);                            // Enable ADC interrupt

}
void ADC_Handler()
{
  static uint32_t Count;
  lastConversion = ADC->ADC_CDR[7];
  //lastConversion = ADC->ADC_LCDR;//Do NOT clear EOC7 bit
  
  Flag = true;

  if(Count++ > 44117)
  {
    Count = 0;
    PIOB->PIO_ODSR ^= PIO_ODSR_P27;
  }
}
*/






void loop(){
  
     if (Flag== true)
        {
          Flag = false;
           // A new conversion is available
        }
  }




void Timer2_handler(void){
    
    analogReadResolution(12);
    
    i++;
    
    
    
    value = analogRead( VOL_PIN );

    volt = value * (3.3/ 4095.0) ;
    //volt = value * (0.001221) ;
    
    //current = (volt - 2.5)*(25/0.625) ;
    current = (((volt - 2.5)*40) - average) ;

    if (314>=i && i>=300){
      average += current;

    if (i==314){
      average1 = (average / 14) ;
      //Serial.println(average1);
       
    }
    }
    
    //Serial.print( value );
   // Serial.print( "," );
    //Serial.println( volt ); 
    //Serial.print( "," );
    Serial.println( current ); 
}