XMC42_800WPSU_LLC
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
interrupts_control.h File Reference

Control interrupts header file. More...

#include <DAVE.h>
#include <XMC4200.h>
#include <init_bckgnd.h>

Go to the source code of this file.

Data Structures

union  msg_t
 
struct  LLC_t
 
struct  controller_t
 

Macros

#define CSG_rise_ISR   IRQ_Hdlr_75
 
PWM and SR timing related definitions
#define LLC_PERIOD_MAX   1600
 
#define LLC_PERIOD_MIN   266
 
#define LINEAR_PR_STEP   3
 
#define LLC_COMP_TIME   22
 
#define DEADTIME_TEST   12
 
#define MIN_DEADTIME   13U
 
#define DEADTIME_SLOPE   2457
 
#define DEADTIME_0Hz   43
 
#define DEADTIME_BURST   28
 
#define START_FREQ   177
 
#define PR_START   160
 
#define DUTY_START   28-5
 
#define PR_START_SEQ   115
 
#define DUTY_START_SEQ1   39
 
#define DUTY_START_SEQ2   47
 
#define ADC_START   14
 
#define DEADTIME_R_COMP   9
 
#define DEADTIME_R_START   10+DEADTIME_R_COMP
 
#define DEADTIME_F_COMP   -9
 
#define DEADTIME_F_START   10+DEADTIME_F_COMP
 
#define DRIVER_DELAY_COMP   -9
 
#define DELAY_SR1_SR2_DIFF   9
 
#define DELAY_SR1_ON   29 - 8
 
#define DELAY_SR2_ON   DELAY_SR1_ON-DELAY_SR1_SR2_DIFF
 
#define BELOW_FREQ   888
 
#define RES_FREQ   536
 
#define DELAY_SR1_SR2_OFF_DIFF   9
 
#define DELAY_SR1_OFF_BELOW_1   225 + 13
 
#define DELAY_SR2_OFF_BELOW_1   DELAY_SR1_OFF_BELOW_1-DELAY_SR1_SR2_OFF_DIFF
 
#define DELAY_SR1_OFF_BELOW_2   263 + 13 + 20
 
#define DELAY_SR2_OFF_BELOW_2   DELAY_SR1_OFF_BELOW_2-DELAY_SR1_SR2_OFF_DIFF
 
#define DELAY_SR1_SR2_OFF_DIFF_ABOVE   1
 
#define DELAY_SR1_OFF_ABOVE   16 + 8
 
#define DELAY_SR2_OFF_ABOVE   DELAY_SR1_OFF_ABOVE-DELAY_SR1_SR2_OFF_DIFF_ABOVE
 
#define DELAY_SR1_ON_BURST   13
 
#define DELAY_SR2_ON_BURST   DELAY_SR1_ON_BURST-DELAY_SR1_SR2_DIFF
 
#define DELAY_SR1_OFF_BURST   -8
 
#define DELAY_SR2_OFF_BURST   DELAY_SR1_OFF_BURST-DELAY_SR1_SR2_DIFF
 
#define PERIOD_LLC_TEST   200
 
#define SHADOW_TRANSFER_LLC_SR   (CCU8_GCSS_S2SE_Msk|CCU8_GCSS_S1SE_Msk|CCU8_GCSS_S0SE_Msk)
 
#define SHADOW_TRANSFER_LLC_SR_CLEAR   (CCU8_GCSC_S2SC_Msk|CCU8_GCSC_S1SC_Msk|CCU8_GCSC_S0SC_Msk)
 
Boostrap capacitor charge
#define CHARGE_HS_TOTAL   6
 
#define CHARGE_HS_LOW   1
 
Input voltage limits
#define VDC_BUS_START   11288
 
#define VDC_BUS_START_HYST   11344
 
#define VDC_BUS_STOP   9640
 
#define VDC_BUS_DATA_OK   1448
 
Output voltage limits
#define VOUT_TARGET   16055
 
#define VOUT_ORING_ON   15457
 
#define VOUT_SR_ON   13248
 
#define VOUT_OVP_LATCH   18350
 
#define VOUT_BURST_DIFF   197
 
#define VOUT_BURST   VOUT_TARGET+VOUT_BURST_DIFF
 
Output current protection
#define IOUT_OCP_LATCH_HARD   3228
 
#define IOUT_OCP_LATCH_MED   3043
 
#define IOUT_OCP_LATCH_SOFT   2960
 
#define LS1_HS0_PWM   0x100
 
#define LS0_HS1_PWM   0x80
 
Shifting for ADC related variables and calculation
#define Q15_PRODUCT_SHIFT   15
 
#define ADC_TO_Q15   3
 
#define V_TARGET_STEP   7
 
Peaking filter (IIR) coefficients
#define a1_peak   -1.98622f
 
#define a2_peak   0.9862674721f
 
#define b1_peak   1.99858f
 
#define b2_peak   -0.99862772985841f
 

Typedefs

typedef enum fault fault_t
 
typedef enum burst_mode burst_mode_t
 
typedef enum ramp_loop_mode ramp_loop_mode_t
 

Enumerations

enum  state_t {
  ST_INIT = 0x0, ST_STB = 0x01, ST_CHARGE = 0x02, ST_SOFT_START = 0x04,
  ST_SOFT_START_SR = 0x08, ST_RUNNING = 0x10, ST_BURST = 0x20, ST_OCP = 0x100,
  ST_LATCH = 0x200
}
 
enum  fault {
  F_INIT = 0x0, F_OVP = 0x01, F_OCP_H = 0x02, F_OCP_M = 0x04,
  F_OCP_S = 0x08, F_UVP = 0x10, F_SC = 0x20
}
 
enum  burst_mode { FREQ_OPERATION = 0, BURST_ON = 1 }
 
enum  ramp_loop_mode { ramp = 0, loop = 1 }
 

Functions

__STATIC_INLINE void sync_OFF ()
 
__STATIC_INLINE void sync_ON ()
 
__STATIC_INLINE void PWM_OFF ()
 
__STATIC_INLINE void PWM_ON ()
 
__STATIC_INLINE void ORING_ON ()
 
__STATIC_INLINE void ORING_OFF ()
 
__STATIC_INLINE void LED_ON_DCOK ()
 
__STATIC_INLINE void LED_OFF_DCNOTOK ()
 
__STATIC_INLINE void ENABLE_SEC_ON ()
 
__STATIC_INLINE void ENABLE_SEC_OFF ()
 
__STATIC_INLINE void over_voltage_protection ()
 
__STATIC_INLINE void over_current_protection ()
 

Variables

__IO uint32_t * ADCResult_iR
 
__IO uint32_t * ADCResult_12V
 
__IO uint32_t * ADCResult_12VOr
 
__IO uint32_t * ADCResult_iOut
 
volatile controller_t voltage_int_ctr
 
volatile uint16_t time_count_100kHz
 
volatile uint16_t time_IMON_100kHz
 
static volatile uint8_t OCP_hard_count = 0
 
volatile uint8_t start_sequence_count
 
volatile state_t status_reg
 
volatile fault_t fault_reg
 
volatile burst_mode_t burst_status
 
volatile LLC_t LLC
 
volatile uint16_t Temp_fan
 

Detailed Description

Control interrupts header file.

Author
Meneses Herrera, David
Date
20.06.2017

Definition in file interrupts_control.h.

Macro Definition Documentation

#define a1_peak   -1.98622f

Definition at line 262 of file interrupts_control.h.

#define a2_peak   0.9862674721f

Definition at line 263 of file interrupts_control.h.

#define ADC_START   14

ADC trigger of the first pulse in asymmetric PWM

Definition at line 113 of file interrupts_control.h.

Referenced by main(), start_sequence_ISR(), and state_control().

#define ADC_TO_Q15   3

ADC normalization shift (Q15)

Definition at line 252 of file interrupts_control.h.

Referenced by control_loop_ISR(), and state_control().

#define b1_peak   1.99858f

Definition at line 265 of file interrupts_control.h.

#define b2_peak   -0.99862772985841f

Definition at line 266 of file interrupts_control.h.

#define BELOW_FREQ   888

Corner frequencies for SR timing

Definition at line 136 of file interrupts_control.h.

Referenced by voltage_loop().

#define CHARGE_HS_LOW   1

Number of ISR cycles with low LS during HS cap charging sequence

Definition at line 180 of file interrupts_control.h.

Referenced by state_control().

#define CHARGE_HS_TOTAL   6

Total number of ISR cycles for HS cap charging sequence

Definition at line 177 of file interrupts_control.h.

#define CSG_rise_ISR   IRQ_Hdlr_75

Definition of comparator interrupt

Definition at line 60 of file interrupts_control.h.

#define DEADTIME_0Hz   43

Dead time at 0Hz for dead time calculation under 200kHz operation

Definition at line 89 of file interrupts_control.h.

Referenced by burst_mode(), and voltage_loop().

#define DEADTIME_BURST   28

Fixed dead time at burst mode operation (400kHz operation)

Definition at line 92 of file interrupts_control.h.

#define DEADTIME_F_COMP   -9

Rising edge dead time compensation of different driver

Definition at line 122 of file interrupts_control.h.

Referenced by burst_mode(), and voltage_loop().

#define DEADTIME_F_START   10+DEADTIME_F_COMP

Falling edge dead time compensation of different driver during start-up sequence

Definition at line 125 of file interrupts_control.h.

Referenced by main(), and state_control().

#define DEADTIME_R_COMP   9

Rising edge dead time compensation of different driver

Definition at line 116 of file interrupts_control.h.

Referenced by burst_mode(), and voltage_loop().

#define DEADTIME_R_START   10+DEADTIME_R_COMP

Rising edge dead time compensation of different driver during start-up sequence

Definition at line 119 of file interrupts_control.h.

Referenced by main(), and state_control().

#define DEADTIME_SLOPE   2457

Slope for the dead time calculation under 200kHz operation

Definition at line 86 of file interrupts_control.h.

Referenced by burst_mode(), and voltage_loop().

#define DEADTIME_TEST   12

Definition at line 80 of file interrupts_control.h.

#define DELAY_SR1_OFF_ABOVE   16 + 8

Definition at line 151 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR1_OFF_BELOW_1   225 + 13

Definition at line 144 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR1_OFF_BELOW_2   263 + 13 + 20

Definition at line 146 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR1_OFF_BURST   -8

Definition at line 157 of file interrupts_control.h.

Referenced by burst_mode().

#define DELAY_SR1_ON   29 - 8

Definition at line 132 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR1_ON_BURST   13

Burst mode operation delays

Definition at line 155 of file interrupts_control.h.

Referenced by burst_mode().

#define DELAY_SR1_SR2_DIFF   9

Set on delay of SR

Definition at line 131 of file interrupts_control.h.

#define DELAY_SR1_SR2_OFF_DIFF   9

SR off delay for under resonance operation 1: Under RES_FREQ 2: Under BELOW_FREQ

Definition at line 143 of file interrupts_control.h.

#define DELAY_SR1_SR2_OFF_DIFF_ABOVE   1

Above resonance turn off delay

Definition at line 150 of file interrupts_control.h.

#define DELAY_SR2_OFF_ABOVE   DELAY_SR1_OFF_ABOVE-DELAY_SR1_SR2_OFF_DIFF_ABOVE

Definition at line 152 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR2_OFF_BELOW_1   DELAY_SR1_OFF_BELOW_1-DELAY_SR1_SR2_OFF_DIFF

Definition at line 145 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR2_OFF_BELOW_2   DELAY_SR1_OFF_BELOW_2-DELAY_SR1_SR2_OFF_DIFF

Definition at line 147 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR2_OFF_BURST   DELAY_SR1_OFF_BURST-DELAY_SR1_SR2_DIFF

Definition at line 158 of file interrupts_control.h.

Referenced by burst_mode().

#define DELAY_SR2_ON   DELAY_SR1_ON-DELAY_SR1_SR2_DIFF

Definition at line 133 of file interrupts_control.h.

Referenced by voltage_loop().

#define DELAY_SR2_ON_BURST   DELAY_SR1_ON_BURST-DELAY_SR1_SR2_DIFF

Definition at line 156 of file interrupts_control.h.

Referenced by burst_mode().

#define DRIVER_DELAY_COMP   -9

Compensation of different driver delay

Definition at line 128 of file interrupts_control.h.

Referenced by burst_mode(), start_sequence_ISR(), and voltage_loop().

#define DUTY_START   28-5

Duty cycle of the first pulse in asymmetric PWM

Definition at line 101 of file interrupts_control.h.

Referenced by main(), and state_control().

#define DUTY_START_SEQ1   39

Duty cycle of the following pulses in asymmetric PWM sequence

Definition at line 107 of file interrupts_control.h.

#define DUTY_START_SEQ2   47

Duty cycle of the following pulses in asymmetric PWM sequence

Definition at line 110 of file interrupts_control.h.

#define IOUT_OCP_LATCH_HARD   3228

Output current limit for latching protection, fault cleared whith input voltage cycle

Definition at line 229 of file interrupts_control.h.

Referenced by over_current_protection().

#define IOUT_OCP_LATCH_MED   3043

Output current limit for latching protection, fault cleared whith input voltage cycle

Definition at line 232 of file interrupts_control.h.

Referenced by over_current_protection().

#define IOUT_OCP_LATCH_SOFT   2960

Output current limit for latching protection, fault cleared whith input voltage cycle

Definition at line 235 of file interrupts_control.h.

Referenced by over_current_protection().

#define LINEAR_PR_STEP   3

Period step during linear variation until soft-start begins

Definition at line 74 of file interrupts_control.h.

#define LLC_COMP_TIME   22

Waiting time after zero crossing of the current before inverting the PWM signal

Definition at line 77 of file interrupts_control.h.

#define LLC_PERIOD_MAX   1600

Minimum frequency allowed, expressed as maximum period

Definition at line 68 of file interrupts_control.h.

Referenced by control_loop_init(), state_control(), and voltage_loop().

#define LLC_PERIOD_MIN   266

Maximum frequency allowed, expressed as minimum period

Definition at line 71 of file interrupts_control.h.

Referenced by burst_mode(), state_control(), and voltage_loop().

#define LS0_HS1_PWM   0x80

Short circuit detection based on iR; LLC PWM output LS='0', HS='1'

Definition at line 241 of file interrupts_control.h.

#define LS1_HS0_PWM   0x100

Short circuit detection based on iR; LLC PWM output LS='1', HS='0'

Definition at line 238 of file interrupts_control.h.

#define MIN_DEADTIME   13U

Minimum dead time to be applied at frequencies lower than 200kHz

Definition at line 83 of file interrupts_control.h.

Referenced by main(), state_control(), and voltage_loop().

#define PERIOD_LLC_TEST   200

Definition at line 165 of file interrupts_control.h.

#define PR_START   160

Frequency of the first pulse in asymmetric PWM

Definition at line 98 of file interrupts_control.h.

Referenced by main(), and state_control().

#define PR_START_SEQ   115

Frequency of the following pulses in asymmetric PWM sequence

Definition at line 104 of file interrupts_control.h.

Referenced by start_sequence_ISR().

#define Q15_PRODUCT_SHIFT   15

Q15 product required shift

Definition at line 249 of file interrupts_control.h.

Referenced by burst_mode(), and voltage_loop().

#define RES_FREQ   536

Definition at line 137 of file interrupts_control.h.

Referenced by voltage_loop().

#define SHADOW_TRANSFER_LLC_SR   (CCU8_GCSS_S2SE_Msk|CCU8_GCSS_S1SE_Msk|CCU8_GCSS_S0SE_Msk)

Definition at line 167 of file interrupts_control.h.

Referenced by burst_mode(), state_control(), and voltage_loop().

#define SHADOW_TRANSFER_LLC_SR_CLEAR   (CCU8_GCSC_S2SC_Msk|CCU8_GCSC_S1SC_Msk|CCU8_GCSC_S0SC_Msk)

Definition at line 169 of file interrupts_control.h.

Referenced by state_control().

#define START_FREQ   177

Frequency of the first pulses after asymmetric PWM (600kHz operation)

Definition at line 95 of file interrupts_control.h.

Referenced by start_sequence_ISR(), and state_control().

#define V_TARGET_STEP   7

Shift for step of reference voltage ramp up: step = target/(2^V_TARGET_STEP)

Definition at line 255 of file interrupts_control.h.

#define VDC_BUS_DATA_OK   1448

Difference between two consecutive samples under certain value to be accepted

Definition at line 197 of file interrupts_control.h.

#define VDC_BUS_START   11288

Input voltage limit for starting

Definition at line 188 of file interrupts_control.h.

Referenced by state_control().

#define VDC_BUS_START_HYST   11344

Input voltage limit for starting

Definition at line 191 of file interrupts_control.h.

Referenced by state_control().

#define VDC_BUS_STOP   9640

Input voltage threshold for turn off LLC

Definition at line 194 of file interrupts_control.h.

Referenced by state_control().

#define VOUT_BURST   VOUT_TARGET+VOUT_BURST_DIFF

Output voltage limit for burst operation

Definition at line 221 of file interrupts_control.h.

Referenced by burst_mode().

#define VOUT_BURST_DIFF   197

Output voltage positive difference limit for burst operation

Definition at line 218 of file interrupts_control.h.

#define VOUT_ORING_ON   15457

Output voltage threshold for Oring switching

Definition at line 209 of file interrupts_control.h.

Referenced by state_control().

#define VOUT_OVP_LATCH   18350

Output voltage limit for latching protection

Definition at line 215 of file interrupts_control.h.

Referenced by over_voltage_protection().

#define VOUT_SR_ON   13248

Output voltage threshold for Oring switching

Definition at line 212 of file interrupts_control.h.

Referenced by state_control().

#define VOUT_TARGET   16055

Output voltage target

Definition at line 206 of file interrupts_control.h.

Referenced by control_loop_init(), and state_control().

Typedef Documentation

typedef enum burst_mode burst_mode_t

Defined fault states used to manage the converter protections

typedef enum fault fault_t

Defined fault states used to manage the converter protections

Define if the frequency is ramping in open loop during soft-start or the control loop takes over

Enumeration Type Documentation

enum burst_mode

Defined fault states used to manage the converter protections

Enumerator
FREQ_OPERATION 
BURST_ON 

Definition at line 326 of file interrupts_control.h.

enum fault

Defined fault states used to manage the converter protections

Enumerator
F_INIT 
F_OVP 
F_OCP_H 
F_OCP_M 
F_OCP_S 
F_UVP 
F_SC 

Definition at line 313 of file interrupts_control.h.

Define if the frequency is ramping in open loop during soft-start or the control loop takes over

Enumerator
ramp 
loop 

Definition at line 333 of file interrupts_control.h.

enum state_t

Defined states to be used in the starting sequence and state machine

Enumerator
ST_INIT 
ST_STB 
ST_CHARGE 
ST_SOFT_START 
ST_SOFT_START_SR 
ST_RUNNING 
ST_BURST 
ST_OCP 
ST_LATCH 

Definition at line 295 of file interrupts_control.h.

Function Documentation

__STATIC_INLINE void ENABLE_SEC_OFF ( )

Definition at line 531 of file interrupts_control.h.

__STATIC_INLINE void ENABLE_SEC_ON ( )

Definition at line 521 of file interrupts_control.h.

Referenced by main().

__STATIC_INLINE void LED_OFF_DCNOTOK ( )

Definition at line 510 of file interrupts_control.h.

Referenced by main(), and state_control().

__STATIC_INLINE void LED_ON_DCOK ( )

Definition at line 499 of file interrupts_control.h.

Referenced by voltage_loop().

__STATIC_INLINE void ORING_OFF ( )
__STATIC_INLINE void ORING_ON ( )

Definition at line 479 of file interrupts_control.h.

Referenced by state_control().

__STATIC_INLINE void over_current_protection ( )
__STATIC_INLINE void over_voltage_protection ( )
__STATIC_INLINE void PWM_OFF ( )
__STATIC_INLINE void PWM_ON ( )

Definition at line 465 of file interrupts_control.h.

Referenced by state_control().

__STATIC_INLINE void sync_OFF ( )
__STATIC_INLINE void sync_ON ( )

Definition at line 437 of file interrupts_control.h.

Referenced by state_control().

Variable Documentation

volatile uint8_t OCP_hard_count = 0
static

Definition at line 399 of file interrupts_control.h.

Referenced by over_current_protection().