3.3kW Totem-pole PFC with CoolMOS and XMC1402
Control Interrupts

Files

file  control_interrupts.c
 Control related interrupts code.
 
file  control_interrupts.h
 Interrupts code.
 

Functions

void current_loop_ISR (void)
 Current loop interrupt.
CR2 while counting up in CCU80.CC81 (PWM-PFC) triggers the ADC queue.
A result event of the queue triggers this interrupt.
Prio 1. More...
 
void current_ref_ISR (void)
 Current reference interrupt.
pwm_count counts number of PWM cycles.
PR event of pwm_count triggers the current_fed_ISR() at a defined number of switching cycles.
Prio 2. More...
 
void voltage_loop_ISR (void)
 Voltage control interrupt.
Timer CCU40.CC42 triggers this interrupt in the period match event.
IIR low-pass filter of the AC voltage to obtain the RMS value.
IIR notch filter of the DC voltage to remove 100Hz and 120 Hz component.
Voltage loop and voltage monitoring.
State machine for start-up and event management.
Prio 3. More...
 

Variables

static volatile uint8_t i_filter = 0
 
volatile PFC_var_t PFC
 
volatile uint16_t time_count_5kHz = 0
 
static volatile uint16_t current_loop_cnt = 0
 

ADC results

volatile uint32_t * ADCResult_iL
 
volatile uint32_t * ADCResult_DCBus
 
volatile uint32_t * ADCResult_VAC
 
volatile uint32_t * ADCResult_Temp
 

Control and Fault status registers

volatile state_t status_reg = ST_INIT
 
volatile fault_t fault_reg = F_INIT
 

Detailed Description

Function Documentation

◆ current_loop_ISR()

void current_loop_ISR ( void  )

Current loop interrupt.
CR2 while counting up in CCU80.CC81 (PWM-PFC) triggers the ADC queue.
A result event of the queue triggers this interrupt.
Prio 1.

Returns
None

Link to function documentation:
iL_modif()
iL_loop()
iL_coeff()
pseudo_pll()

TPPFC_Iloop_flow.png
3300W Bidirectional Totem-pole current loop ISR flow diagram



◆ current_ref_ISR()

void current_ref_ISR ( void  )

Current reference interrupt.
pwm_count counts number of PWM cycles.
PR event of pwm_count triggers the current_fed_ISR() at a defined number of switching cycles.
Prio 2.

Returns
None

Link to function documentation:
iL_offset_calc()
iL_ref()
iL_deadtime()

TPPFC_Iref_flow.png
3300W Bidirectional Totem-pole current reference ISR flow diagram



◆ voltage_loop_ISR()

void voltage_loop_ISR ( void  )

Voltage control interrupt.
Timer CCU40.CC42 triggers this interrupt in the period match event.
IIR low-pass filter of the AC voltage to obtain the RMS value.
IIR notch filter of the DC voltage to remove 100Hz and 120 Hz component.
Voltage loop and voltage monitoring.
State machine for start-up and event management.
Prio 3.

Returns
None

Link to function documentation:
state_machine()
bulk_monitoring()

TPPFC_Vloop_schedule.png
3300W Bidirectional Totem-pole CCM voltage loop ISR flow diagram.



PFC_INV_statemachine.png
3300W Bidirectional Totem-pole CCM state machine for PFC (left) and Inverter (right) operation.

Variable Documentation

◆ ADCResult_DCBus

volatile uint32_t* ADCResult_DCBus

DC bus Voltage ADC result.

◆ ADCResult_iL

volatile uint32_t* ADCResult_iL

Inductor current ADC result.

◆ ADCResult_Temp

volatile uint32_t* ADCResult_Temp

Temperature sense ADC result.

◆ ADCResult_VAC

volatile uint32_t* ADCResult_VAC

AC Voltage ADC result.

◆ current_loop_cnt

volatile uint16_t current_loop_cnt = 0
static

Debugging variable to count switching cycles

◆ fault_reg

volatile fault_t fault_reg = F_INIT

Variable that holds the possible faults of the PFC

◆ i_filter

volatile uint8_t i_filter = 0
static

Counter for reducing sampling frequency of the IIR filter

◆ PFC

volatile PFC_var_t PFC

Instance of the PFC needed variables.

◆ status_reg

volatile state_t status_reg = ST_INIT

Variable that holds the operation state of the PFC

◆ time_count_5kHz

volatile uint16_t time_count_5kHz = 0

Time counting based on PWM interrupt