H4-PFC Infineon 1600W Server PSU
Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
init_bckgnd_funct.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018, Infineon Technologies AG
3
* <br>All rights reserved.
4
* <br>Redistribution and use in source and binary forms, with or without
5
* modification,are permitted provided that the following conditions are met:
6
* - Redistributions of source code must retain the above copyright notice,
7
* this list of conditions and the following disclaimer.
8
* - Redistributions in binary form must reproduce the above copyright notice,
9
* this list of conditions and the following disclaimer in the documentation
10
* and/or other materials provided with the distribution.
11
* - Neither the name of the copyright holders nor the names of its contributors
12
* may be used to endorse or promote products derived from this software without
13
* specific prior written permission.
14
* .
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
* CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
* POSSIBILITY OF SUCH DAMAGE.
26
* <br>To improve the quality of the software, users are encouraged to share
27
* modifications, enhancements or bug fixes with Infineon Technologies AG
28
* dave@infineon.com).
29
*/
30
43
#ifndef INIT_BCKGND_FUNCT_H_
44
#define INIT_BCKGND_FUNCT_H_
45
46
/***********************************************************************************************************************
47
* HEADER FILES
48
**********************************************************************************************************************/
49
50
#include <DAVE.h>
51
52
/*********************************************************************************************************************
53
* MACROS
54
********************************************************************************************************************/
62
#define DIV_AUTO_START 0
63
66
#define UNSIGNED_DIVISION 4
67
70
#define SIGNED_DIVISION 0
71
74
#define DIV_32BIT_BY_32BIT 0
75
78
#define MAX_DUTY_SOFTSTART 1430 // 97%-1475U --> 1430;
79
81
#define CLK_CORE_HZ 48000000UL
82
88
#define VIN_MIN_START_INIT 2281 //2281 --> 174Vrms/3.3Vdd
89
90
#define VIN_MIN_START 2281 //2281 --> 174Vrms/3.3Vdd
91
92
#define VIN_MIN_STOP_HARD 1490 // 1665 --> 127Vrms/3.3Vdd; 1490, considering filter response (step from 230V)
93
94
#define VIN_MIN_PLD_68V 1901 // 1901 --> 145Vrms/3.3Vdd
95
96
#define VIN_MIN_PLD_75V 2255 // 2255 --> 172Vrms/3.3Vdd
97
104
#define I_IN_AVG_MAX 19382 //19382 --> 25A/3.3Vdd/976R-200R-1ADC-2SW
105
106
#define I_IN_MAX16b 0xFFFFU //0xFFFFU = 65535
107
108
#define I_IN_FACTOR 1
109
110
#define I_IN_MAX_FACTOR (I_IN_MAX16b >> I_IN_FACTOR)
111
119
#define LIMIT_1_MILI_S 65
120
121
#define LIMIT_100_MILI_S 100
122
124
/*********************************************************************************************************************
125
* Type definition
126
********************************************************************************************************************/
128
typedef
struct
FIR_lowpass_int
129
{
130
uint16_t
n
;
131
int16_t
h
[9];
132
int32_t
x
[17];
133
int32_t
output_int
;
134
int16_t
output
;
135
}
FIR_lowpass_int_t
;
136
138
typedef
struct
IIR_lowpass_int
139
{
140
int16_t
k1
;
141
int16_t
a1
[3];
142
int16_t
b1
[3];
143
int32_t
u1
[3];
144
int16_t
k2
;
145
int16_t
a2
[3];
146
int16_t
b2
[3];
147
int32_t
u2
[3];
148
int32_t
output1
;
149
int32_t
output
;
151
int32_t
calc11
;
152
int32_t
calc21
;
153
int32_t
calc12
;
154
int32_t
calc22
;
156
}
IIR_lowpass_int_t
;
157
159
typedef
struct
controller_PI
160
{
161
int32_t
a0
;
162
int32_t
a1
;
163
int32_t
a2
;
164
int32_t
aux
;
165
uint8_t
qformat
;
166
uint8_t
shift_to_q13
;
167
uint8_t
shift_to_q29
;
168
int32_t
state_output
[3];
169
int16_t *
duty_iL
;
170
// uint16_t duty_ff; /**< Duty cycle information obtained from the input voltage measurement (feedforward) */
171
int16_t
duty
;
172
int32_t
state_error
[3];
173
int16_t
max_duty
;
174
uint16_t
PI_ref
;
175
uint32_t
PI_ref_int
;
176
uint16_t
PI_ref_max
;
177
int16_t
duty_OL
;
178
int32_t
interm_calc1
;
179
int32_t
interm_calc2
;
180
}
controller_PI_t
;
181
183
typedef
struct
controller_int
184
{
185
int16_t
a
[3];
186
int16_t
b
[3];
187
uint8_t
qformat
;
188
uint8_t
shift_to_q15
;
189
int16_t
error
[3];
190
int32_t
state
[3];
191
int32_t
output_int
;
192
int16_t *
output_int_limit
;
193
int16_t
soft_start
;
194
uint16_t
output
;
195
int16_t
output_max
;
196
uint16_t
int_ref
;
197
uint16_t
ref_offset_LCDO
;
198
uint16_t
int_ref_steady
;
199
int32_t
interm_calc1
;
200
int32_t
interm_calc2
;
201
bool
first_iter
;
202
}
controller_int_t
;
203
204
/*********************************************************************************************************************
205
* External global variables
206
********************************************************************************************************************/
207
// AC-RMS Filter instance
208
extern
volatile
IIR_lowpass_int_t
ACfilter
;
209
210
// DC-bus Filter instance
211
//extern volatile FIR_lowpass_int_t DCfilter;
212
extern
volatile
IIR_lowpass_int_t
DCfilter
;
213
214
// Scaled AC voltage for filter operation
215
extern
volatile
int32_t
auxAC
;
216
217
// Scaled DC voltage for filter operation
218
extern
volatile
int32_t
auxDC
;
219
220
extern
volatile
uint16_t
time_count_65kHz
;
221
222
extern
uint8_t
_1ms_count
;
223
extern
uint8_t
_100ms_count
;
224
extern
uint8_t
time_BOP
;
225
extern
uint8_t
time_ACOK
;
226
extern
uint8_t
time_PLD_68V
;
227
extern
uint8_t
time_PLD_75V
;
228
extern
uint8_t
time_V_step
;
229
extern
uint8_t
time_INIT
;
230
extern
uint8_t
time_extra_bulk
;
231
232
extern
volatile
bool
power_stage_ON
;
233
234
extern
volatile
controller_int_t
voltage_int_ctr
;
235
extern
volatile
controller_PI_t
current_PI_ctr
;
236
237
/***********************************************************************************************************************
238
* Function Prototypes
239
**********************************************************************************************************************/
240
void
IIR_param_init
(
void
);
241
242
void
MATH_DIV_config
(
void
);
243
244
void
control_loop_init
(
void
);
245
246
void
time_counter
(
void
);
247
248
void
temperature_sense_enable
(
void
);
249
250
void
delay_100us
(uint32_t time);
251
252
void
input_voltage_observer
(
void
);
253
254
void
fan_control_temp_protection
(
void
);
255
256
#endif
/* INIT_BCKGND_FUNCT_H_ */
257
init_bckgnd_funct.h
Generated on Tue Jan 9 2018 14:44:04 for H4-PFC Infineon 1600W Server PSU by
1.8.3.1