14 #include "config/hal.h" 15 #include "app_power_control.h" 17 #include "devices/dev_boost_converter.h" 18 #include "drivers/v_loop.h" 32 volatile uint16_t appPowerSupply_ConverterObjectInitialize(
void)
34 volatile uint16_t retval = 1;
249 volatile uint16_t appPowerSupply_ControllerInitialize(
void)
251 volatile uint16_t retval = 1;
391 volatile uint16_t appPowerSupply_PeripheralsInitialize(
void)
393 volatile uint16_t retval=1;
395 retval &= drv_BoostConverter_Initialize(&boost);
#define BOOST_VOUT_VFWD_DROP
Macro calculating the integer number equivalent of the maximum forward voltage drop across teh rectif...
volatile uint16_t ptrExtHookSourceFunction
Pointer to Function which will be called after the source has been read and compensated....
enum BOOST_CONTROL_MODE_e control_mode
Fundamental control mode.
volatile uint8_t trigger_source
input channel trigger source
volatile uint16_t pwm_instance
number of the PWM channel used
#define BOOST_PWM_ADTR1PS
ADC Trigger 1 Postscaler: 0...31.
volatile int16_t MinOutput
Minimum output value used for clamping (R/W)
volatile uint16_t * ptrDProvControlInput
Pointer to external data buffer of most recent, raw control input.
volatile struct NPNZ_PORT_s AltSource
Secondary data input port declaration.
volatile uint16_t ExtHookSourceFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
volatile struct NPNZ_PORTS_s Ports
Controller input and output ports.
volatile uint16_t * ptrDProvControlError
Pointer to external data buffer of most recent control error.
volatile struct NPNZ16b_s * controller
pointer to control loop object data structure
volatile int16_t factor
Fractional scaling factor (range -1 ... 0.99969)
volatile int16_t Offset
Value/signal offset of this port.
void(* ctrl_Update)(volatile struct NPNZ16b_s *)
Function pointer to UPDATE routine.
volatile uint16_t timeout
Soft-Start VCAP Charge-Up Monitor Period Counter Timeout (state machine fault state trigger)
volatile struct BOOST_STARTUP_PERIOD_HANDLER_s v_ramp
Voltage Ramp-Up period deinitions.
volatile uint16_t dead_time_falling
Dead time setting at falling edge of a half-bridge drive.
volatile uint16_t ExtHookExitFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
#define BOOST_VOUT_NORM_FACTOR
VOUT normalization factor scaled in Q15.
#define BOOST_PWM_GPIO_INSTANCE
Number indicating device port, where 0=Port RA, 0=Port RB, 0=Port RC, etc.
volatile uint16_t leb_period
Leading-Edge Blanking period.
volatile bool adc_active
Bit #1: indicating that ADC has been started and samples are taken.
volatile bool swap_outputs
Selecting if PWMxH (default) or PWMxL should be the leading PWM output.
volatile bool fault_active
Bit #5: Flag bit indicating system is in enforced shut down mode (usually due to a fault condition)
volatile uint16_t trigger_scaler
PWM triggers for ADC will be generated every n-th cycle.
#define BOOST_VOUT_TRGSRC
PWM2 (=PG2) Trigger 1 via PGxTRIGA.
volatile bool high_resolution_enable
Selecting if PWM module should use high-resolution mode.
volatile bool swap_source
Bit 13: when set, AltSource is used as data input to controller.
#define BOOST_VIN_ADCCORE
0=Dedicated Core #0, 1=Dedicated Core #1, 8=Shared ADC Core
volatile uint16_t control_output
BOOST most recent control output value.
volatile uint8_t adc_input
number of the ADC input channel used
volatile uint16_t period
Soft-Start Period (POD, RAMP PERIOD, PGD, etc.)
volatile uint16_t usrParam3
generic 16-bit wide, user-defined parameter #4 for advanced control options
volatile struct NPNZ_PORT_s Source
Primary data input port declaration.
volatile uint16_t i_ref_startup
User setting of the initial current reference at startup (used to limit startup currents)
volatile fractional AgcFactor
Q15 value of Adaptive Gain Modulation factor.
#define BOOST_PWM_OUTPUT_SWAP
true = PWMxH is the leading PWM output, false = PWMxL is the leading PWM output
volatile struct BOOST_SWITCH_NODE_SETTINGS_s sw_node[BOOST_MPHASE_COUNT]
BOOST converter switch node settings.
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_vout
ADC input sampling output voltage.
#define BOOST_PWM_GPIO_PORT_PINH
Port Pin Number.
volatile uint16_t dead_time_rising
Dead time setting at rising edge of a half-bridge drive.
#define BOOST_VOUT_NORM_SCALER
VOUT normalization.
volatile bool enabled
input channel enable bit
#define BOOST_PWM_PDC
PWM Instance Duty Cycle Register.
volatile uint16_t v_ref
User reference setting used to control the power converter controller.
volatile uint16_t gpio_instance
GPIO instance of the selected PWM generator.
volatile uint16_t usrParam6
generic 16-bit wide, user-defined parameter #7 for advanced control options
volatile struct NPNZ_PORT_s Target
Primary data output port declaration.
volatile uint16_t control_error
BOOST most recent control error value.
volatile struct BOOST_LOOP_SETTINGS_s v_loop
BOOST voltage control loop object.
volatile uint16_t period
Soft-Start VCAP Charge-Up Period (minimum time to wait when voltage has settled)
volatile uint16_t usrParam1
generic 16-bit wide, user-defined parameter #2 for advanced control options
volatile struct NPNZ_LIMITS_s Limits
Input and output clamping values.
#define BOOST_PWM_PERIOD
This sets the switching period of the converter.
volatile uint16_t counter
Soft-Start VCAP Charge-Up Period Counter.
#define BOOST_VOUT_ADCBUF
ADC input buffer of this ADC channel.
volatile uint16_t ref_inc_step
Size/value of one reference increment/decrement or this period.
#define BOOST_ISNS_NORM_FACTOR
ISNS normalization factor scaled in Q15.
volatile uint16_t duty_ratio_init
Initial duty cycle when the PWM module is being turned on.
volatile uint16_t no_of_phases
number of converter phases
volatile bool agc_enabled
Bit 11: when set, Adaptive Gain Control Modulation is enabled.
#define BOOST_VIN_OFFSET
Input voltage feedback offset.
volatile uint16_t i_ref
User reference setting used to control the power converter controller.
volatile uint16_t io_type
Input/Output definition (0=push-pull output, 1=input, 2=open-drain output)
#define BOOST_PWM_GPIO_PORT_PINL
Port Pin Number.
#define BOOST_PWM_PHASE_SHIFT
This sets the phase shift between phase #1 and #2.
volatile fractional AgcMedian
Q15 value of Adaptive Gain Modulation nominal operating point.
volatile uint16_t gpio_low
GPIO port pin-number of PWMxL of the selected PWM generator.
#define BOOST_VIN_ANSEL
GPIO analog function mode enable bit.
volatile uint16_t period
Switching period.
#define BOOST_VOUT_ADC_TRGDLY
Macro calculating the integer number equivalent of the signal chain time delay between internal PWM t...
#define BOOST_ISNS_FB_OFFSET
volatile bool sync_drive
Selecting if switch node is driven in synchronous or asnchronous mode.
volatile struct NPNZ_USER_DATA_BUFFER_s Advanced
Parameter section for advanced user control options.
volatile uint16_t phase
Switching signal phase-shift.
volatile uint16_t * ptrDProvControlInputCompensated
Pointer to external data buffer of most recent, compensated control input.
volatile uint16_t AgcScaler
Bit-shift scaler of Adaptive Gain Modulation factor.
volatile uint16_t gpio_high
GPIO port pin-number of PWMxH of the selected PWM generator.
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_temp
ADC input sampling temperature.
volatile uint16_t minimum
output clamping value (minimum)
volatile uint16_t feedback_offset
Feedback offset value for calibration or bi-direction feedback signals.
#define BOOST_LEB_PERIOD
Leading Edge Blanking = n x PWM resolution (here: 50 x 2ns = 100ns)
volatile bool lower_saturation_event
Bit 0: control loop is clamped at minimum output level.
volatile uint16_t usrParam0
generic 16-bit wide, user-defined parameter #1 for advanced control options
volatile uint16_t temp
BOOST board temperature.
#define BOOST_VOUT_REF
Macro calculating the integer number equivalent of the output voltage reference given above in [V].
volatile uint16_t * adc_buffer
pointer to ADC result buffer
volatile uint16_t v_in
BOOST input voltage.
#define BOOST_VOUT_ANSEL
ADC input assignments of output voltage feedback signals.
#define BOOST_ISNS_ADCCORE
0=Dedicated Core #0, 1=Dedicated Core #1, 2=Shared ADC Core
volatile uint16_t pin
GPIO port pin number.
volatile uint16_t(* ctrl_Initialize)(volatile struct NPNZ16b_s *)
Function pointer to INIT routine.
volatile bool enabled
Bit #15: Control bit enabling/disabling the charger port.
volatile struct BOOST_CONVERTER_STARTUP_s startup
BOOST startup timing settings.
void(* ctrl_Reset)(volatile struct NPNZ16b_s *)
Function pointer to RESET routine.
volatile struct BOOST_STARTUP_PERIOD_HANDLER_s power_good_delay
Power-Good Delay period deinitions.
#define BOOST_ISNS_ADCIN
Analog input number (e.g. '5' for 'AN5')
volatile bool enabled
Specifies, if this IO is used or not.
volatile uint8_t adc_core
number of the ADC core connected to the selected channel
volatile bool ready
Bit #0: status bit, indicating boost converter is initialized and ready to run.
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_vin
ADC input sampling input voltage.
volatile uint16_t ptrExtHookExitFunction
Pointer to Function which is called at the end of the control loop and will also be called when the c...
void(* ctrl_Precharge)(volatile struct NPNZ16b_s *, volatile fractional, volatile fractional)
Function pointer to PRECHARGE routine.
#define BOOST_VIN_NORM_FACTOR
VIN normalization factor scaled in Q15.
volatile bool pwm_active
Bit #2: indicating that PWM has been started and ADC triggers are generated.
#define BOOST_ISNS_REF
Output Current Reference.
volatile struct BOOST_GPIO_INSTANCE_s PowerGood
Power Good Output.
volatile uint16_t usrParam4
generic 16-bit wide, user-defined parameter #5 for advanced control options
volatile int16_t AltMinOutput
Alternate minimum output value used for clamping (R/W)
#define TEMP_ADCBUF
GPIO analog function mode enable bit.
volatile uint16_t duty_ratio_max
Absolute duty cycle maximum during normal operation.
#define BOOST_ISNS_TRGSRC
PWM2 (=PG2) Trigger 2 via PGxTRIGB.
volatile uint16_t reference
Control loop reference variable.
volatile uint16_t control_input
BOOST most recent control input value (raw input)
volatile uint16_t ExtHookPreTargetWriteFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
#define BOOST_POD
Conversion Macros of Startup Timing Settings.
volatile uint16_t counter
Soft-Start Execution Counter (read only)
volatile struct BOOST_STARTUP_VCAP_PRECHARGE_s vcap_monitor
Output Capacitor Charging Time period deinitions.
volatile uint16_t ADCTriggerAOffset
ADC trigger #1 offset to compensate propagation delays.
#define BOOST_PWM_DEAD_TIME_LE
Rising edge dead time [tick = 250ps].
volatile struct BOOST_CONVERTER_DATA_s data
BOOST runtime data.
volatile bool async_mode
Bit #9: Control bit suspending the synchronous rectifier switch PWM channel.
#define BOOST_PWM_DEAD_TIME_FE
Falling edge dead time [tick = 250ps].
volatile uint16_t v_drop
Acceptable voltage drop between input and output voltage when output capacitor is charging up.
#define BOOST_ISNS_ADC_TRGDLY
volatile uint16_t ExtHookPreAntiWindupFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
#define BOOST_VIN_ADCTRIG
Register used for trigger placement.
volatile struct NPNZ_STATUS_s status
Control Loop Status and Control flags.
#define TEMP_ANSEL
GPIO analog function mode enable bit.
#define BOOST_VOUT_OFFSET
Macro calculating the integer number equivalent of the physical, static signal offset of this feedbac...
#define BOOST_VOUT_ADCTRIG
Register used for trigger placement.
#define BOOST_VOUT_ADCIN
Analog input number (e.g. '5' for 'AN5')
volatile bool differential_input
input channel differential mode enable bit
#define BOOST_PWM_DC_MAX
This sets the maximum duty cycle.
#define BOOST_PWM_DC_MIN
This sets the minimum duty cycle.
volatile int16_t NormScaler
Bit-shift scaler of the Q15 normalization factor.
volatile uint16_t ExtHookStartFunctionParam
Parameter of function called (can be a variable or pointer to a data structure). This parameter is op...
#define BOOST_VOUT_ADCCORE
0=Dedicated Core #0, 1=Dedicated Core #1, 8=Shared ADC Core
volatile uint16_t polarity
Output polarity, where 0=ACTIVE HIGH, 1=ACTIVE_LOW.
volatile bool early_interrupt_enable
input channel early interrupt enable bit
volatile uint16_t timeout_counter
Soft-Start VCAP Charge-Up Timeout Counter.
volatile uint16_t ADCTriggerBOffset
ADC trigger #2 offset to compensate propagation delays.
volatile int16_t MaxOutput
Maximum output value used for clamping (R/W)
#define BOOST_PWM_ADTR1OFS
ADC Trigger 1 Offset: 0...31.
volatile struct BOOST_ADC_INPUT_SCALING_s scaling
normalization scaling settings
volatile struct NPNZ_PORT_s AltTarget
Secondary data output port declaration.
volatile uint16_t ptrExtHookPreTargetWriteFunction
Pointer to Function which will be called before the most recent control output is written to target....
#define BOOST_VIN_ADCBUF
ADC input buffer of this ADC channel.
volatile uint16_t i_sns[BOOST_MPHASE_COUNT]
BOOST output current.
volatile uint16_t * ptrAddress
Pointer to register or variable where the value is read from (e.g. ADCBUFx) or written to (e....
volatile uint16_t maximum
output clamping value (maximum)
volatile uint16_t v_out
BOOST output voltage.
volatile bool invert_input
Bit 14: when set, most recent error input value to controller is inverted.
volatile struct NPNZ_DATA_PROVIDERS_s DataProviders
Automated data sources pushing recent data points to user-defined variables.
volatile struct BOOST_FEEDBACK_SETTINGS_s feedback
BOOST converter feedback settings.
volatile bool interrupt_enable
input channel interrupt enable bit
#define BOOST_VIN_NORM_SCALER
VIN normalization.
volatile uint16_t usrParam2
generic 16-bit wide, user-defined parameter #3 for advanced control options
volatile uint16_t ptrExtHookPreAntiWindupFunction
Pointer to Function which will be called after the compensation filter computation is complete and be...
volatile fractional NormFactor
Q15 normalization factor.
volatile struct BOOST_CONVERTER_STATUS_s status
BOOST operation status bits.
#define BOOST_ISNS_ANSEL
GPIO analog function mode enable bit.
volatile bool upper_saturation_event
Bit 1: control loop is clamped at maximum output level.
volatile uint16_t ptrExtHookStartFunction
Pointer to Function which will be called at the beginning of the control loop. This function pointer ...
volatile uint16_t * ptrDProvControlOutput
Pointer to external data buffer of most recent control output.
volatile uint16_t ExtHookEndOfLoopFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
volatile uint16_t trigger_offset
PWM triggers for ADC will be offset by n cycles.
volatile uint16_t * ptrADCTriggerBRegister
Pointer to ADC trigger #2 register (e.g. TRIG2)
#define BOOST_PWM_CHANNEL
PWM peripheral output pins, control signals and register assignments of converter phase #1.
volatile uint16_t reference
Internal dummy reference used to increment/decrement controller reference.
volatile bool signed_result
input channel singed result mode enable bit
volatile uint16_t port
GPIO port instance number (0=Port RA, 0=Port RB, 0=Port RC, etc.)
volatile int16_t offset
Signal offset as signed integer to be subtracted from ADC input.
volatile int16_t AltMaxOutput
Alternate maximum output value used for clamping (R/W)
#define BOOST_VIN_ADCIN
Analog input number (e.g. '5' for 'AN5')
volatile bool cs_calib_enable
Bit #8: Flag bit indicating that current sensors need to calibrated.
#define BOOST_VIN_TRGSRC
PWM2 (=PG2) Trigger 2 via PGxTRIGB.
volatile uint16_t usrParam5
generic 16-bit wide, user-defined parameter #6 for advanced control options
#define BOOST_ISNS_NORM_SCALER
ISNS normalization.
volatile uint16_t duty_ratio_min
Absolute duty cycle minimum during normal operation.
volatile struct BOOST_GPIO_SETTINGS_s gpio
BOOST converter additional GPIO specification.
volatile uint16_t * ptrControlReference
Pointer to global variable of input register holding the controller reference value (e....
#define BOOST_ISNS_ADCBUF
ADC input buffer of this ADC channel.
volatile struct BOOST_STARTUP_PERIOD_HANDLER_s power_on_delay
Power-On Delay period deinitions.
volatile struct BOOST_STATE_ID_s state_id
BOOST state machine operating state ID.
volatile struct NPNZ_GAIN_CONTROL_s GainControl
Parameter section for advanced control options.
volatile bool master_period_enable
Selecting MASTER or Individual period register.
#define BOOST_ISNS_REF_STARTUP
Output Current Startup Reference.
volatile struct BOOST_GPIO_INSTANCE_s EnableInput
External ENABLE input.
volatile struct BOOST_STARTUP_PERIOD_HANDLER_s i_ramp
Current Ramp-Up period deinitions.
volatile bool autorun
Bit #14: Control bit determining if charger is starting automatically or on command (using the GO bit...
volatile uint16_t trigger_offset
ADC trigger offset value for trigger fine-tuning.
volatile struct BOOST_ADC_INPUT_SETTINGS_s ad_isns[BOOST_MPHASE_COUNT]
ADC input sampling phase current.
volatile bool level_trigger
input channel level trigger mode enable bit
volatile uint16_t * ptrADCTriggerARegister
Pointer to ADC trigger #1 register (e.g. TRIG1)
volatile struct NPNZ_ADC_TRGCTRL_s ADCTriggerControl
Automatic ADC trigger placement options for ADC Trigger A and B.
volatile struct BOOST_CONVERTER_SETTINGS_s set_values
Control field for global access to references.
volatile bool swap_target
Bit 12: when set, AltTarget is used as data output of controller.
volatile bool enabled
Bit 15: enables/disables control loop execution.
volatile uint16_t ptrExtHookEndOfLoopFunction
Pointer to Function which is called at the end of the control loop but will be bypassed when the cont...
volatile uint16_t usrParam7
generic 16-bit wide, user-defined parameter #8 for advanced control options
volatile struct NPNZ_EXTENSION_HOOKS_s ExtensionHooks
User extension function triggers using function pointers with parameters.
volatile int16_t scaler
Feedback bit-shift scaler used for number normalization.