45 #ifndef BUCK_CONVERTER_TYPE_DEF_H
46 #define BUCK_CONVERTER_TYPE_DEF_H
54 #include "power_control/drivers/npnz16b.h"
55 #include "config/hal.h"
63 #define BUCK_MPHASE_COUNT BUCK_NO_OF_PHASES
74 BUCK_STAT_READY = 0b0000000000000001,
75 BUCK_STAT_ADC_ACTIVE = 0b0000000000000010,
76 BUCK_STAT_PWM_ACTIVE = 0b0000000000000100,
77 BUCK_STAT_POWERSOURCE_DETECTED = 0b0000000000001000,
78 BUCK_STAT_CS_SENSE_READY = 0b0000000000010000,
80 BUCK_STAT_FORCED_SHUT_DOWN = 0b0000000010000000,
81 BUCK_STAT_BUSY = 0b0000000100000000,
84 BUCK_STAT_GO = 0b0010000000000000,
85 BUCK_STAT_AUTORUN = 0b0100000000000000,
86 BUCK_STAT_NO_AUTORUN = 0b0000000000000000,
88 BUCK_STAT_ENABLED = 0b1000000000000000,
89 BUCK_STAT_DISABLED = 0b0000000000000000
102 BUCK_OPSTATE_ERROR = 0x00,
103 BUCK_OPSTATE_INITIALIZE = 0x01,
104 BUCK_OPSTATE_RESET = 0x02,
105 BUCK_OPSTATE_STANDBY = 0x03,
106 BUCK_OPSTATE_RAMPUP = 0x04,
107 BUCK_OPSTATE_ONLINE = 0x05
121 BUCK_OPSTATE_POWER_ON_DELAY = 0x00,
122 BUCK_OPSTATE_PREPARE_V_RAMP = 0x01,
123 BUCK_OPSTATE_V_RAMP_UP = 0x02,
124 BUCK_OPSTATE_I_RAMP_UP = 0x03,
125 BUCK_OPSTATE_PWRGOOD_DELAY = 0x04
138 BUCK_OPSRET_ERROR = 0x0000,
139 BUCK_OPSRET_COMPLETE = 0x0001,
140 BUCK_OPSRET_REPEAT = 0x0002
154 BUCK_CONTROL_MODE_VMC = 0,
155 BUCK_CONTROL_MODE_PCMC = 1,
156 BUCK_CONTROL_MODE_ACMC = 2
226 } __attribute__((packed))
bits;
volatile struct BUCK_CONVERTER_CONSTANTS_s BuckConverterConstants
Structure providing all public enumerated lists of constants.
#define BUCK_MPHASE_COUNT
Declaration of the number of power train phases of the Buck Converter.
BUCK_SUBSTATES_e
Enumeration of state machine operating sub-states.
BUCK_OPSTATE_RETURNS_e
Enumeration of state machine operating state return values.
BUCK_CONTROL_MODE_e
Enumeration of the power supply mode control.
BUCK_STATUS_FLAGS_e
Enumeration of status and control flags.
BUCK_OPSTATES_e
Enumeration of state machine operating states.
Structure providing all public enumerated lists of constants.
enum BUCK_STATUS_FLAGS_e StatusFlags
List of all status and control flags of the Buck Converter status word.
enum BUCK_OPSTATES_e OpStateOpCodes
List of State Machine Operating State IDs.
enum BUCK_SUBSTATES_e SubStateOpCodes
List of State Machine Sub-State IDs.
enum BUCK_CONTROL_MODE_e ControlModes
List of Supported Control Modes.
enum BUCK_OPSTATE_RETURNS_e OpStateReturnValues
List of State Machine Operating State Return Values.
Generic power controller status word.
volatile bool enabled
Bit #15: Control bit enabling/disabling the charger port.
volatile bool ready
Bit #0: status bit, indicating buck converter is initialized and ready to run.
volatile bool cs_calib_enable
Bit #8: Flag bit indicating that current sensors need to calibrated.
volatile unsigned
Bit #10: (reserved)
volatile bool pwm_active
Bit #2: indicating that PWM has been started and ADC triggers are generated.
volatile bool async_mode
Bit #9: Control bit suspending the synchronous rectifier switch PWM channel.
volatile bool fault_latch
Bit #4: Flag bit indicating system is in latched enforced shut down mode (requires manual clearance)
volatile bool busy
Bit #7: Flag bit indicating that the state machine is executing a process (e.g. startup-ramp)
struct BUCK_CONVERTER_STATUS_s::@126::@128 bits
data structure for single bit addressing operations
volatile bool suspend
Bit #6: Control bit to put the converter in suspend mode (turned off while ENABLE bit is still on)
volatile bool GO
Bit #13: When set, the GO-bit fires up the power supply.
volatile bool fault_active
Bit #3: Flag bit indicating system is in enforced shut down mode (usually due to a fault condition)
volatile bool autorun
Bit #14: Control bit determining if charger is starting automatically or on command (using the GO bit...
volatile bool adc_active
Bit #1: indicating that ADC has been started and samples are taken.
volatile bool cs_calib_complete
Bit #5: indicating that current sensor calibration has completed.
data structure for the buck statement ID for sub-operating and operating states
enum BUCK_SUBSTATES_e substate_id
Most recent operating state of active sub state machine.
enum BUCK_OPSTATES_e opstate_id
Most recent operating state of main state machine.
struct BUCK_STATE_ID_s::@129::@131 bits
Generic power controller startup period settings.
volatile uint16_t period
Soft-Start Period (POD, RAMP PERIOD, PGD, etc.)
volatile uint16_t ref_inc_step
Size/value of one reference increment/decrement or this period.
volatile uint16_t counter
Soft-Start Execution Counter (read only)
volatile uint16_t reference
Internal dummy reference used to increment/decrement controller reference.
Power Converter Startup Timing Settings.
volatile struct BUCK_STARTUP_PERIOD_HANDLER_s power_good_delay
volatile struct BUCK_STARTUP_PERIOD_HANDLER_s v_ramp
volatile struct BUCK_STARTUP_PERIOD_HANDLER_s power_on_delay
volatile struct BUCK_STARTUP_PERIOD_HANDLER_s i_ramp
Publicly accessible data buffer of most recent runtime data values.
volatile uint16_t control_input
BUCK most recent control input value (raw input)
volatile uint16_t v_out
BUCK output voltage.
volatile uint16_t i_out
BUCK common output current.
volatile uint16_t temp
BUCK board temperature.
volatile uint16_t control_output
BUCK most recent control output value.
volatile uint16_t control_error
BUCK most recent control error value.
volatile uint16_t i_sns[BUCK_NO_OF_PHASES]
BUCK output current.
volatile uint16_t v_in
BUCK input voltage.
Generic power controller control settings.
volatile uint16_t i_ref
User reference setting used to control the power converter controller.
volatile uint16_t v_ref
User reference setting used to control the power converter controller.
enum BUCK_CONTROL_MODE_e control_mode
Fundamental control mode.
volatile uint16_t no_of_phases
number of converter phases
User defined settings for control loops;.
void(* ctrl_Precharge)(volatile struct NPNZ16b_s *, volatile fractional, volatile fractional)
Function pointer to PRECHARGE routine.
volatile uint16_t maximum
output clamping value (maximum)
volatile uint16_t feedback_offset
Feedback offset value for calibration or bi-direction feedback signals.
volatile struct NPNZ16b_s * controller
pointer to control loop object data structure
void(* ctrl_Update)(volatile struct NPNZ16b_s *)
Function pointer to UPDATE routine.
void(* ctrl_Reset)(volatile struct NPNZ16b_s *)
Function pointer to RESET routine.
volatile uint16_t reference
Control loop reference variable.
volatile uint16_t trigger_offset
ADC trigger offset value for trigger fine-tuning.
volatile uint16_t(* ctrl_Initialize)(volatile struct NPNZ16b_s *)
Function pointer to INIT routine.
volatile uint16_t minimum
output clamping value (minimum)
Peak Current Mode Control Slope Compensation Settings.
volatile uint16_t dac_instance
Digital-to-analog converter instance used to generate the the slope compensation ramp.
volatile uint16_t duty_cycle_limit
Switch node duty cycle limit value.
volatile uint16_t slope_start_trigger
Period counter value at with the slope start is triggered.
volatile uint16_t cmp_input
Analog comparator input option A to D (0=A, 1=B, 2=C, 3=D)
volatile uint16_t pwm_trigger_input
PWM current limit PCI input source (must match comparator declared by cmp_instance)
volatile uint16_t slew_rate
Integer equivalent of compensation ramp slew rate in [V/µs].
volatile uint16_t cmp_instance
Analog comparator triggering on the peak current feedback signal.
volatile uint16_t slope_stop_trigger
Period counter value at with the slope stop is triggered.
volatile uint16_t * ptr_duty_cycle
Pointer to switch node duty cycle register.
volatile uint16_t initial_dac_value
Initial Digital-to-Analog converter reference value (used when peripheral is enabled or being reset)
Switching signal timing settings.
volatile struct BUCK_SLOPE_COMP_SETTINGS_s slope_compensation
Peak current mode slope compensation settings.
volatile uint16_t leb_period
Leading-Edge Blanking period.
volatile uint16_t period
Switching period.
volatile uint16_t adc_trigger_offset
PWM triggers for ADC will be offset by n cycles.
volatile uint16_t duty_ratio_init
Initial duty cycle when the PWM module is being turned on.
volatile uint16_t duty_ratio_max
Absolute duty cycle maximum during normal operation.
volatile bool sync_drive
Selecting if switch node is driven in synchronous or asnchronous mode.
volatile uint16_t gpio_low
GPIO port pin-number of PWMxL of the selected PWM generator.
volatile uint16_t duty_ratio_min
Absolute duty cycle minimum during normal operation.
volatile uint16_t dead_time_rising
Dead time setting at rising edge of a half-bridge drive.
volatile uint16_t gpio_instance
GPIO instance of the selected PWM generator.
volatile bool swap_outputs
Selecting if PWMxH (default) or PWMxL should be the leading PWM output.
volatile uint16_t gpio_high
GPIO port pin-number of PWMxH of the selected PWM generator.
volatile uint16_t phase
Switching signal phase-shift.
volatile uint16_t adc_trigger_scaler
PWM triggers for ADC will be generated every n-th cycle.
volatile bool high_resolution_enable
Selecting if PWM module should use high-resolution mode.
volatile uint16_t pwm_instance
number of the PWM channel used
volatile uint16_t dead_time_falling
Dead time setting at falling edge of a half-bridge drive.
volatile bool master_period_enable
Selecting MASTER or Individual period register.
ADC input signal scaling = (ADCBUF - <offset>) * <factor> >> 2^<scaler>
volatile int16_t factor
Fractional scaling factor (range -1 ... 0.99969)
volatile int16_t offset
Signal offset as signed integer to be subtracted from ADC input.
volatile int16_t scaler
Feedback bit-shift scaler used for number normalization.
ADC input channel configuration.
volatile bool early_interrupt_enable
input channel early interrupt enable bit
volatile bool enabled
input channel enable bit
volatile uint8_t adc_core
number of the ADC core connected to the selected channel
volatile uint8_t trigger_source
input channel trigger source
volatile struct BUCK_ADC_INPUT_SCALING_s scaling
normalization scaling settings
volatile bool interrupt_enable
input channel interrupt enable bit
volatile uint16_t gpio_instance
GPIO instance of the selected PWM generator.
volatile bool level_trigger
input channel level trigger mode enable bit
volatile bool signed_result
input channel singed result mode enable bit
volatile bool differential_input
input channel differential mode enable bit
volatile uint8_t adc_input
number of the ADC input channel used
volatile uint16_t * adc_buffer
pointer to ADC result buffer
Buck converter feedback declarations.
volatile struct BUCK_ADC_INPUT_SETTINGS_s ad_vin
ADC input sampling input voltage.
volatile struct BUCK_ADC_INPUT_SETTINGS_s ad_isns[BUCK_NO_OF_PHASES]
ADC input sampling phase current.
volatile struct BUCK_ADC_INPUT_SETTINGS_s ad_temp
ADC input sampling temperature.
volatile struct BUCK_ADC_INPUT_SETTINGS_s ad_vout
ADC input sampling output voltage.
GPIO instance of the converter control GPIO.
volatile bool enabled
Specifies, if this IO is used or not.
volatile uint16_t io_type
Input/Output definition (0=push-pull output, 1=input, 2=open-drain output)
volatile uint16_t port
GPIO port instance number (0=Port RA, 0=Port RB, 0=Port RC, etc.)
volatile uint16_t polarity
Output polarity, where 0=ACTIVE HIGH, 1=ACTIVE_LOW.
volatile uint16_t pin
GPIO port pin number.
GPIO instance of the converter control GPIO.
volatile struct BUCK_GPIO_INSTANCE_s EnableInput
External ENABLE input.
volatile struct BUCK_GPIO_INSTANCE_s PowerGood
Power Good Output.
BUCK control & monitoring data structure.
volatile struct BUCK_SWITCH_NODE_SETTINGS_s sw_node[BUCK_NO_OF_PHASES]
BUCK converter switch node settings.
volatile struct BUCK_LOOP_SETTINGS_s i_loop[BUCK_NO_OF_PHASES]
BUCK Current control loop objects.
volatile struct BUCK_STATE_ID_s state_id
BUCK state machine operating state ID.
volatile struct BUCK_CONVERTER_STATUS_s status
BUCK operation status bits.
volatile struct BUCK_FEEDBACK_SETTINGS_s feedback
BUCK converter feedback settings.
volatile struct BUCK_GPIO_SETTINGS_s gpio
BUCK converter additional GPIO specification.
volatile struct BUCK_LOOP_SETTINGS_s v_loop
BUCK voltage control loop object.
volatile struct BUCK_CONVERTER_DATA_s data
BUCK runtime data.
volatile struct BUCK_CONVERTER_SETTINGS_s set_values
Control field for global access to references.
volatile struct BUCK_CONVERTER_STARTUP_s startup
BUCK startup timing settings.
Generic NPNZ16b Controller Object. This data structure is the main API data object providing single-p...