3.3kW Totem-pole PFC with SiC and XMC1404
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
init_bckgnd_funct.c File Reference

Functions for SW initialization and running in the background during operation. More...

#include "init_bckgnd_funct.h"
#include "control_interrupts.h"
#include "communication.h"

Macros

#define FLASH_CLK_DIV   (10)
 
#define FLASH_SLEEP_DLY   (3000000 >> 10)
 

Functions

void MATH_DIV_config ()
 DIV kernel of the MATH co-processor initialization.
Used in the input RMS feedforward. More...
 
void control_loop_init ()
 Assign value to the coefficients of voltage and current loops.
Reset the state and output of both controllers.
Reset current offset calculation variables.
Set initial power for inverter operation. More...
 
void IIR_param_init (void)
 IIR coefficients initialization.
IIR cascaded low-pass filter of the AC voltage to obtain the RMS value.
IIR notch filter of the DC voltage to remove 100/120Hz ripple.
Sampling frequency of both filters is 2500Hz, every 2 cycles of CCU40.CC41 @ 5kHz. More...
 
void time_counter ()
 Time counter is a background process to count "real-time" in the application. More...
 
void delay_100us (uint32_t time)
 Delay function. More...
 
void PFC_INV_mode ()
 Operation mode (PFC - AC/DC or inverter - DC/AC) selection function.
Decision taken only once when starting the application. More...
 
void input_voltage_observer ()
 BOP protection, checking AVG input voltage.
The function modifies the control status register. More...
 
void flash_sleep_ctr ()
 Flash memory sleep state control. More...
 

Variables

static uint16_t flash_sleep_cnt = FLASH_SLEEP_DLY
 
AC voltage filter variables
volatile IIR_lowpass_int_t ACfilter
 
volatile int32_t auxAC = 0
 
DC-bus voltage filter variables
volatile IIR_lowpass_int_t DCfilter
 
volatile int32_t auxDC = 0
 
Controller structures
volatile controller_int_t voltage_int_ctr
 
volatile controller_PI_t current_PI_ctr
 
volatile bool power_stage_ON = false
 
volatile bool current_loop_ON = false
 
Time counters
uint8_t _1ms_count = 0
 
uint8_t _100ms_count = 0
 
uint8_t time_BOP = 0
 
uint8_t time_ACOK = 0
 
uint8_t time_PLD_130V = 0
 
uint8_t time_PLD_150V = 0
 
uint8_t time_V_step = 0
 
uint16_t time_INIT = 200
 
uint8_t time_extra_bulk = 0
 
Input voltage monitoring flags
static bool BOP_flag_150V = false
 
static bool BOP_flag_130V = false
 

Detailed Description

Functions for SW initialization and running in the background during operation.

Author
Meneses Herrera, David; Escudero Rodriguez, Manuel
Date
22.05.2019