3.3kW Totem-pole PFC with SiC and XMC1404
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
communication.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018, Infineon Technologies AG
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification,are permitted provided that the following conditions are met:
7
*
8
* - Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
* - Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
13
* - Neither the name of the copyright holders nor the names of its contributors
14
* may be used to endorse or promote products derived from this software without
15
* specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
* POSSIBILITY OF SUCH DAMAGE.
28
*
29
* To improve the quality of the software, users are encouraged to share
30
* modifications, enhancements or bug fixes with Infineon Technologies AG
31
* dave@infineon.com).
32
*/
43
#ifndef __COMMUNICATION_H_
44
#define __COMMUNICATION_H_
45
46
//#include "control_interrupts.h"
47
#include "xmc_flash.h"
48
54
#define CONVERTER (5)
55
56
#define VERSION_BITS (8)
57
58
#define VERSION (1)
59
#if VERSION >= (1 << VERSION_BITS)
60
#error "VERSION should be smaller than (2^VERSION_BITS)."
61
#endif
62
63
#define SUB_VERSION (0)
64
#if SUB_VERSION >= (1 << VERSION_BITS)
65
#error "SUB_VERSION should be smaller than (2^VERSION_BITS)."
66
#endif
67
70
typedef
union
71
{
72
struct
73
{
74
uint8_t _fill[3];
75
uint8_t
command
;
76
union
77
{
78
uint32_t ui32[1];
79
uint16_t ui16[2];
80
uint8_t ui8[4];
81
} payload;
82
} msg;
83
struct
84
{
85
uint8_t _fill[3];
86
uint8_t ui8[5];
87
} raw;
88
}
msg_t
;
89
98
#define UART_WRITE_MSK (0x00)
99
100
#define UART_SAVE (0x06)
101
102
#define UART_READ (0x80)
103
105
#define UART_STATUS_S (0x04)
106
108
#define SOFT_VER (0x25)
109
110
#define CONVERTER_ID (0x26)
111
113
#define UART_DT_D2S (0x34)
114
115
#define UART_DT_S2D_MAX (0x35)
116
117
#define UART_DT_S2D_MIN (0x36)
118
119
#define UART_CONST_I (0x37)
120
121
#define UART_OFF_REG1 (0x38)
122
123
#define UART_SLOPE_REG1 (0x39)
124
125
#define UART_REG1_I (0x40)
126
127
#define UART_OFF_REG2 (0x41)
128
129
#define UART_SLOPE_REG2 (0x42)
130
131
#define UART_REG2_I (0x43)
132
133
#define UART_POWER (0x44)
134
136
//#define METER_VO (0x20)
138
//#define METER_IO (0x21)
140
//#define METER_VIN (0x22)
142
//#define METER_IIN (0x23)
143
//
145
//#define SOFT_VER (0x25)
147
//#define CONVERTER_ID (0x26)
149
//#define NTC_TMP (0x27)
151
//#define DIE_TMP (0x28)
152
//
154
//#define UART_BUCK_BOOST_SLCTN (0x30)
165
#define UART_ON_OFF_START (0x8080)
166
167
#define UART_ON_OFF_STOP (0x0101)
168
169
#define UART_BOOST_MODE (0x8080)
170
171
#define UART_BUCK_MODE (0x0101)
172
175
#define MASTER_KEY (1)
176
177
#define UART_TRANSMIT_CLK_DIV (2)
178
179
/*
180
* Warning: for uC with the software already running.
181
* If the order of these parameters is altered the values previously stored in
182
* flash would not be in place. Adjust the parameters again through the GUI.
183
*/
185
typedef
struct
186
{
187
uint16_t
dt_d2s
;
188
uint16_t
dt_s2d_MAX
;
189
uint16_t
dt_s2d_MIN
;
190
uint16_t
dt_const_iLimit
;
191
uint16_t
dt_s2d_offreg1
;
192
uint16_t
dt_s2d_slopereg1
;
193
uint16_t
dt_reg1_iLimit
;
194
uint16_t
dt_s2d_offreg2
;
195
uint16_t
dt_s2d_slopereg2
;
196
uint16_t
dt_reg2_iLimit
;
197
uint16_t
power_target
;
198
uint16_t
master_key
;
199
}
params_t
;
200
201
/*---------------------------------------------------------------------------*/
202
extern
uint32_t XMC_USIC_CH_TXFIFO_GetLevel(XMC_USIC_CH_t *
const
channel);
203
extern
const
params_t
*
parameters_ROM
;
204
extern
const
params_t
parameters_DFLT
;
205
extern
params_t
parameters_RAM
;
206
void
uart_transmit
();
207
void
uart_receive
();
208
void
load_ROM_parameters
();
209
void
check_RAM_parameters
();
210
211
#endif
/* __COMMUNICATION_H_ */
212
communication.h
Generated on Wed Feb 5 2020 08:19:34 for 3.3kW Totem-pole PFC with SiC and XMC1404 by
1.8.3.1