Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches
drv_pwrctrl_app_misc_TPBLPFC.c
Go to the documentation of this file.
1
10/*
11� [2024] Microchip Technology Inc. and its subsidiaries.
12
13 Subject to your compliance with these terms, you may use Microchip
14 software and any derivatives exclusively with Microchip products.
15 You are responsible for complying with 3rd party license terms
16 applicable to your use of 3rd party software (including open source
17 software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
18 NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
19 SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
20 MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
21 WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
22 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
23 KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
24 MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
25 FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
26 TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
27 EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
28 THIS SOFTWARE.
29*/
30
31#include <xc.h>
32#include <stdint.h>
33
34#include "../../../mcc_generated_files/system/pins.h"
35
38#include "PFC_frameworkSetup.h"
39#include "../../misc/MCC_add_on.h"
40
41
53{
54 OpenLoopStartupDuration = OPEN_LOOP_STARTUP_PULSES;
55
56 //Compensation out of DCDT: icomp1lv/hv_dcdt.h, vcomp1ph_dcdt.h
59
60 //##############################################
61 PG1TRIGC = PG1PER >> 1; //180� Phase Shift
62// PG1IOCONLbits.OSYNC = 0b01;
63// PG2IOCONLbits.OSYNC = 0b01;
64 //##############################################
65
68 PWM_GeneratorEnable(PH1_PWM);
69
72 PWM_GeneratorEnable(PH2_PWM);
73
76
78 Adaptive_Gain_Factor = (3276 << 1); //factor 0.2 3276 is factor = 0.1
79}
80
81
93{
94 //<<< only testing >>>
95 PWM_OverrideHighEnable(PH1_PWM); //disable PWM output on Buck-H
96 PWM_OverrideLowEnable(PH1_PWM); //disable PWM output on Buck-L
97 PWM_OverrideHighEnable(PH2_PWM); //disable PWM output on Buck-H
98 PWM_OverrideLowEnable(PH2_PWM); //disable PWM output on Buck-L
99
102 Vout_Control.Reference.Reference_Internal = 0; //new 06.09.2021
104
105 //Burst mode flags must be reset on switch off to ensure proper switch on
106 //afterwards when PFC was in Burst mode before switch off
113}
114
115
129// ramp speed was 1 all the time
130#define SOFT_START_RAMP_SPEED 4 //LV step is 26.9mV, HV step is 25.2mV
131#define STEP_DELAY 30 //30*100us=3ms delay between one step of SOFT_START_RAMP_SPEED
132
134{
135 static uint16_t SoftstartCounter = 0;
136 static PWR_CTRL_STATE_e returnvalue = 1;
137
138#ifdef VOLTAGE_LOOP
139 if (++SoftstartCounter > STEP_DELAY)
140#else
141 if (++SoftstartCounter > 20) //fixed value
142#endif
143 {
145 {
148 {
150 returnvalue = pwr_ctrl_state;
151 }
152 else
153 {
154 returnvalue = PCS_UP_AND_RUNNING;
160 }
161 }
162 else
163 {
166 {
168 returnvalue = pwr_ctrl_state;
169 }
170 else
171 {
172 returnvalue = PCS_UP_AND_RUNNING;
178 }
179 }
180
181 SoftstartCounter = 0;
182 }
183 else
184 returnvalue = pwr_ctrl_state;
185
186 return returnvalue;
187}
188
189//==============================================================================
190//==============================================================================
uint16_t OpenLoopStartupDuration
PHASE_VALUES_t Phase_Values_PH2
PWR_CTRL_STATE_e pwr_ctrl_state
uint16_t Adaptive_Gain_Factor
VMC_VALUES_t Vout_Control
PHASE_VALUES_t Phase_Values_PH1
This is the typedef file for power controller.
PWR_CTRL_STATE_e
@ PCS_UP_AND_RUNNING
void VoltageController_PwrCtrl_TPBLPFC_Init(void)
void CurrentController_PwrCtrl_TPBLPFC_Init(void)
This is the driver header file for the power controller.
void Drv_PwrCtrl_TPBLPFC_Stop(void)
PWR_CTRL_STATE_e Softstart_reference(void)
void Drv_PwrCtrl_TPBLPFC_Init(void)
#define SOFT_START_RAMP_SPEED
Allows the user to change the advanced operating parameters.
#define DEAD_TIME
static void PWM_DeadTimeLowSet(enum PWM_GENERATOR genNum, uint16_t deadtimeLow)
This inline function updates PWM Deadtime low register with the requested value for a specific PWM ge...
Definition pwm.h:683
static void PWM_OverrideLowEnable(enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWML output for specific PWM generator selected by the a...
Definition pwm.h:622
static void PWM_OverrideHighEnable(enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWMH output for specific PWM generator selected by the a...
Definition pwm.h:602
static void PWM_GeneratorEnable(enum PWM_GENERATOR genNum)
This inline function enables the specific PWM generator selected by the argument PWM_GENERATOR.
Definition pwm.h:302
static void PWM_DeadTimeHighSet(enum PWM_GENERATOR genNum, uint16_t deadtimeHigh)
This inline function updates PWM Deadtime high register with the requested value for a specific PWM g...
Definition pwm.h:704
#define PWM_H_N_SetLow()
Sets the RD1 GPIO Pin which has a custom name of PWM_H_N to Low.
Definition pins.h:368
#define PWM_L_N_SetLow()
Sets the RD0 GPIO Pin which has a custom name of PWM_L_N to Low.
Definition pins.h:317
volatile uint16_t Filtered
volatile uint16_t VOUT_Hystresis_High
volatile uint16_t VOUT_Hystresis_Low
volatile uint16_t VOUT_dV_dt_Hystresis_High
volatile uint16_t VOUT_dV_dt_Hystresis_Low
volatile uint16_t Reference_Internal
volatile uint16_t BurstModeCycleCounter
volatile unsigned Control_Freeze
struct CONTROL_STATUS_FLAGS_s::@24::@26 bits
volatile unsigned Reference_Changed
volatile unsigned BurstModeLatched
CONTROLLER_VALUES_t Controller_Values
CONTROL_STATUS_FLAGS_t Control_Status_Flags
CONTROL_REFERENCE_VALUES_t Reference
ANALOG_VALUES_t Vout