Digital Power Starter Kit 3 Firmware  DM330017-3, Rev.3.0
dsPIC33C Buck Converter Peak Current Mode Control Example
app_power_config.c
1 /*
2  * File: app_power_config.c
3  * Author: M91406
4  *
5  * Created on January 13, 2021, 12:18 PM
6  */
7 
8 
9 #include <xc.h> // include processor files - each processor file is guarded.
10 #include <stdint.h> // include standard integer data types
11 #include <stdbool.h> // include standard boolean data types
12 #include <stddef.h> // include standard definition data types
13 
14 #include "config/hal.h" // include hardware abstraction layer declarations
15 #include "app_power_control.h"
16 
17 #include "devices/dev_buck_converter.h"
18 #include "drivers/v_loop.h"
19 #include "drivers/v_loop_extensions.h"
20 
21 
34 {
35  volatile uint16_t retval = 1;
36 
37  // Initialize Buck Converter Object Status
38  buck.status.bits.ready = false; // Clear READY flag
39  buck.status.bits.adc_active = false; // Clear ADC STARTED flag
40  buck.status.bits.pwm_active = false; // clear PWM STARTED flag
41  buck.status.bits.fault_active = true; // Set global FAULT flag
42 
43  buck.status.bits.cs_calib_enable = BUCK_ISNS_OFFSET_CALIBRATION_ENABLE; // Disable current sense feedback calibration
44  buck.status.bits.async_mode = false; // Start up converter in synchronous mode
45  buck.status.bits.autorun = true; // Allow the buck converter to start automatically when cleared of faults
46  buck.status.bits.enabled = false; // Disable buck converter
47 
48  // Set Initial State Machine State
49  buck.state_id.value = BUCK_OPSTATE_INITIALIZE; // Reset Buck State Machine
50 
51  // Set Reference values
52  buck.set_values.control_mode = BUCK_CONTROL_MODE_PCMC; // Set Control Mode
53  buck.set_values.no_of_phases = BUCK_NO_OF_PHASES; // Set number of power train phases
54  buck.set_values.i_ref = BUCK_ISNS_REF; // Set current loop reference
55  buck.set_values.v_ref = BUCK_VOUT_REF; // Set voltage loop reference
56 
57  // Clear Runtime Data
58  buck.data.v_out = 0; // Reset output voltage value
59  buck.data.i_sns[0] = 0; // Reset output current value
60  buck.data.v_in = 0; // Reset input voltage value
61  buck.data.temp = 0; // Reset output temperature value
62 
63  // Initialize Switch Node
70  buck.sw_node[0].sync_drive = true;
82 
93 
94  // Initialize additional GPIOs
95 
96  // ~~~ EXTERNAL ENABLE INPUT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97  buck.gpio.EnableInput.enabled = false; // this converter doesn't support external enable control
98  // ~~~ EXTERNAL ENABLE INPUT END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99 
100  // ~~~ POWER GOOD OUTPUT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 
102  buck.gpio.PowerGood.enabled = true; // This converter supports an additional POWER GOOD output
103  buck.gpio.PowerGood.port = PWRGOOD_PORT; // Number of the GPIO port (0=A, 1=B, 2=C, etc.)
104  buck.gpio.PowerGood.pin = PWRGOOD_PIN; // Number of the GPIO port pin
105  buck.gpio.PowerGood.polarity = 0; // This pin is ACTIVE HIGH (only required if io_type = OUTPUT)
106  buck.gpio.PowerGood.io_type = 0; // This pin is configured as Push-Pull OUTPUT
107 
108  // ~~~ POWER GOOD OUTPUT END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109 
110 
111  // Initialize Feedback Channels
112 
113  // ~~~ OUTPUT VOLTAGE FEEDBACK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
114 
115  buck.feedback.ad_vout.enabled = true; // Use this channel
116 
121 
127 
131 
133 
134  // ~~~ OUTPUT VOLTAGE FEEDBACK END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135 
136  // ~~~ INPUT VOLTAGE FEEDBACK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137 
138  buck.feedback.ad_vin.enabled = true; // Use this channel
139 
144 
150 
154 
156 
157  // ~~~ INPUT VOLTAGE FEEDBACK END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158 
159  // ~~~ OUTPUT CURRENT FEEDBACK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160 
161  buck.feedback.ad_isns[0].enabled = true; // Use this channel
162 
167 
172  buck.feedback.ad_isns[0].signed_result = false;
173 
177 
179 
180  // ~~~ OUTPUT CURRENT FEEDBACK END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181 
182  // ~~~ TEMPERATURE FEEDBACK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
183 
184  buck.feedback.ad_temp.enabled = true; // Use this channel
185 
190 
196 
198 
199  // ~~~ TEMPERATURE FEEDBACK END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200 
201  // Initialize Startup Settings
202 
207 
211  if (buck.startup.v_ramp.ref_inc_step == 0)
214 
215  if (buck.set_values.control_mode == BUCK_CONTROL_MODE_ACMC)
216  {
221  }
222 
227 
228 
229  return(retval);
230 }
231 
232 
233 
255 volatile uint16_t appPowerSupply_ControllerInitialize(void)
256 {
257  volatile uint16_t retval = 1;
258 
259  // ~~~ VOLTAGE LOOP CONFIGURATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260 
261  // Initialize Default Loop Configuration
264  buck.v_loop.minimum = 0; //DAC_MIN;
267 
268  // Set Controller Object of Voltage Loop
274 
275  // Configure Voltage Loop Controller Object
276  buck.v_loop.ctrl_Initialize(&v_loop); // Call Initialization Routine setting histories and scaling
277 
278  // Configure controller input ports
279  buck.v_loop.controller->Ports.Source.ptrAddress = &BUCK_VOUT_ADCBUF; // Output Voltage is Common Source
280  buck.v_loop.controller->Ports.Source.Offset = buck.v_loop.feedback_offset; // Output Voltage feedback signal offset
281  buck.v_loop.controller->Ports.Source.NormScaler = BUCK_VOUT_NORM_SCALER; // Output voltage normalization factor bit-shift scaler
282  buck.v_loop.controller->Ports.Source.NormFactor = BUCK_VOUT_NORM_FACTOR; // Output voltage normalization factor fractional
283 
284  buck.v_loop.controller->Ports.AltSource.ptrAddress = &BUCK_VIN_ADCBUF; // Input Voltage Is Alternate Source
285  buck.v_loop.controller->Ports.AltSource.Offset = BUCK_VIN_OFFSET; // Input Voltage feedback signal offset
286  buck.v_loop.controller->Ports.AltSource.NormScaler = BUCK_VIN_NORM_SCALER; // Input voltage normalization factor bit-shift scaler
287  buck.v_loop.controller->Ports.AltSource.NormFactor = BUCK_VIN_NORM_FACTOR; // Input voltage normalization factor fractional
288 
289  // Configure controller output ports
290  buck.v_loop.controller->Ports.Target.ptrAddress = &BUCK_DACxDATH; // PWM Duty Cycle is Control Target
291  buck.v_loop.controller->Ports.Target.Offset = 0; // Static primary output value offset
292  buck.v_loop.controller->Ports.Target.NormScaler = 0; // Primary control output normalization factor bit-shift scaler
293  buck.v_loop.controller->Ports.Target.NormFactor = 0x7FFF; // Primary control output normalization factor fractional
294 
295  buck.v_loop.controller->Ports.AltTarget.ptrAddress = NULL; // No alternate target used
296  buck.v_loop.controller->Ports.AltTarget.Offset = 0; // Static secondary output value offset
297  buck.v_loop.controller->Ports.AltTarget.NormScaler = 0; // Secondary control output normalization factor bit-shift scaler
298  buck.v_loop.controller->Ports.AltTarget.NormFactor = 0x7FFF; // Secondary control output normalization factor fractional
299 
300  // Configure controller control ports
301  buck.v_loop.controller->Ports.ptrControlReference = &buck.v_loop.reference; // Set pointer to Reference
302 
303  // Data Input/Output Limit Configuration
306  buck.v_loop.controller->Limits.AltMinOutput = 0; // not used
307  buck.v_loop.controller->Limits.AltMaxOutput = 0; // not used
308 
309  // ADC Trigger Control Configuration
314 
315  // Initialize Advanced Control Settings (not used in this code example)
316  buck.v_loop.controller->GainControl.AgcFactor = 0x7FFF; // Adaptive Gain Control factor fractional
317  buck.v_loop.controller->GainControl.AgcScaler = 0x0000; // Adaptive Gain Control factor bit-shift scaler
318  buck.v_loop.controller->GainControl.AgcMedian = 0x0000; // Q15 number representing normalized Nominal Operating Point
319 
320  // Data Provider Configuration
325 
326  // User Extension Function Configuration
327  /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328  *
329  * PowerSmart DCLD allows users to create and call user extension
330  * functions from specific locations of the main control loop to
331  * cover design-specific requirements and features which are not
332  * supported by the main controller by default.
333  *
334  * Control Loop User Extension Declaration Example:
335  *
336  * buck.v_loop.controller->ExtensionHooks.ptrExtHookStartFunction = (uint16_t)&my_function;
337  *
338  * Control Loop User Extension Parameter Declaration Example (optional):
339  *
340  * buck.v_loop.controller->ExtensionHooks.ExtHookStartFunctionParam = 512;
341  *
342  * Please refer to the PowerSmart DCLD User Guide for more details about
343  * how to use this feature, its requirements and limitations.
344  *
345  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346  */
347 
354  buck.v_loop.controller->ExtensionHooks.ptrExtHookPreTargetWriteFunction = (uint16_t)&buck_SyncRectControl;
360 
361  // Custom Advanced Control Settings
362  buck.v_loop.controller->Advanced.usrParam0 = (uint16_t)&BUCK_PWM_IOCONL; // Pointer to PGxIOCONL register to set override bits of sync switch
363  buck.v_loop.controller->Advanced.usrParam1 = BUCK_SYNCTHLD_ON; // threshold value turning on sync rectifier switch drive
364  buck.v_loop.controller->Advanced.usrParam2 = BUCK_SYNCTHLD_OFF; // threshold value turning off sync rectifier switch drive
365  buck.v_loop.controller->Advanced.usrParam3 = 0; // No additional advanced control options used
366  buck.v_loop.controller->Advanced.usrParam4 = 0; // No additional advanced control options used
367  buck.v_loop.controller->Advanced.usrParam5 = 0; // No additional advanced control options used
368  buck.v_loop.controller->Advanced.usrParam6 = 0; // No additional advanced control options used
369  buck.v_loop.controller->Advanced.usrParam7 = 0; // No additional advanced control options used
370 
371  // Reset Controller Status
372  buck.v_loop.controller->status.bits.enabled = false; // Keep controller disabled
373  buck.v_loop.controller->status.bits.swap_source = false; // use SOURCE as major control input
374  buck.v_loop.controller->status.bits.swap_target = false; // use TARGET as major control output
375  buck.v_loop.controller->status.bits.invert_input = false; // Do not invert input value
376  buck.v_loop.controller->status.bits.lower_saturation_event = false; // Reset Anti-Windup Minimum Status bit
377  buck.v_loop.controller->status.bits.upper_saturation_event = false; // Reset Anti-Windup Minimum Status bits
378  buck.v_loop.controller->status.bits.agc_enabled = false; // Enable Adaptive Gain Modulation by default
379 
380  // ~~~ VOLTAGE LOOP CONFIGURATION END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
381 
382 
383  return(retval);
384 }
385 
386 
398 {
399  volatile uint16_t retval=1;
400 
402 
403  return(retval);
404 }
405 
406 
407 // end of file
#define PWM_CLOCK_HIGH_RESOLUTION
Enables/disables the PWM generator high resolution mode of 250 ps versus 2 ns.
#define BUCK_VREF_STEP
#define BUCK_IREF_STEP
#define BUCK_IRAMP_PER
#define BUCK_VRAMP_PER
#define BUCK_POD
Conversion Macros of Startup Timing Settings.
#define BUCK_PGD
#define BUCK_NO_OF_PHASES
User-declaration of global defines for PWM signal generator settings.
#define BUCK_PWM_DC_MAX
This sets the maximum duty cycle.
#define BUCK_PWM_DEAD_TIME_FE
Falling edge dead time [tick = 250ps].
#define BUCK_PWM_PHASE_SHIFT
This sets the phase shift between phase #1 and #2.
#define BUCK_LEB_PERIOD
Leading Edge Blanking = n x PWM resolution (here: 50 x 2ns = 100ns)
#define BUCK_PWM_DEAD_TIME_LE
Rising edge dead time [tick = 250ps].
#define BUCK_PWM_DC_MIN
This sets the minimum duty cycle.
#define BUCK_PWM_PERIOD
This sets the switching period of the converter.
#define BUCK_PWM_GPIO_PORT_PINH
Port Pin Number.
#define BUCK_PWM_IOCONL
PWM Instance I/O Control Register.
#define BUCK_PWM_ADTR1PS
ADC Trigger 1 Postscaler: 0...31.
#define BUCK_PWM_CHANNEL
PWM peripheral output pins, control signals and register assignments of converter phase #1.
#define BUCK_PWM_ADTR1OFS
ADC Trigger 1 Offset: 0...31.
#define BUCK_PWM_PDC
PWM Instance Duty Cycle Register.
#define BUCK_PWM_OUTPUT_SWAP
true = PWMxH is the leading PWM output, false = PWMxL is the leading PWM output
#define BUCK_PWM_GPIO_PORT_PINL
Port Pin Number.
#define BUCK_PWM_GPIO_INSTANCE
Number indicating device port, where 0=Port RA, 0=Port RB, 0=Port RC, etc.
#define BUCK_DAC_SLOPE_TRIG_START
Conversion macros for user-declarations of DAC parameters.
#define BUCK_DAC_SLEW_RATE
#define BUCK_DACOUT_VALUE_INITIAL
#define BUCK_DAC_SLOPE_TRIG_STOP
#define BUCK_DAC_INSTANCE
DAC peripheral register assignments of converter phase #1.
#define BUCK_ACMPxIN
Analog comparator input selection (0=CMPxA, 1=CMPxB, 2=CMPxC, 3=CMPxD)
#define BUCK_PCMC_PGxPCIL_PSS
PWM PCI source selection (must match analog comparator instance declaration)
#define BUCK_ACMP_INSTANCE
Analog comparator instance index.
#define BUCK_DACxDATH
PDM DAC referecne register.
#define BUCK_VIN_NORM_FACTOR
VIN normalization factor scaled in Q15.
#define BUCK_VIN_NORM_SCALER
VIN normalization
#define BUCK_VIN_OFFSET
Input voltage feedback offset.
#define BUCK_VIN_ADCCORE
0=Dedicated Core #0, 1=Dedicated Core #1, 8=Shared ADC Core
#define BUCK_VIN_ADCBUF
ADC input buffer of this ADC channel.
#define BUCK_VIN_ADCIN
Analog input number (e.g. '5' for 'AN5')
#define BUCK_VIN_ANSEL
GPIO analog function mode enable bit.
#define BUCK_VIN_TRGSRC
PWM1 (=PG1) Trigger 2 via PGxTRIGB.
#define BUCK_VOUT_NORM_SCALER
VOUT normalization bit-shift scaler
#define BUCK_VOUT_NORM_FACTOR
VOUT normalization factor scaled in Q15.
#define BUCK_VOUT_OFFSET
Macro calculating the integer number equivalent of the physical, static signal offset of this feedbac...
#define BUCK_VOUT_REF
Macro calculating the integer number equivalent of the output voltage reference given above in [V].
#define BUCK_VOUT_ADC_TRGDLY
Macro calculating the integer number equivalent of the signal chain time delay between internal PWM t...
#define BUCK_VOUT_ADCIN
Analog input number (e.g. '5' for 'AN5')
#define BUCK_VOUT_ADCTRIG
Register used for trigger placement.
#define BUCK_VOUT_TRGSRC
PWM1 (=PG1) Trigger 1 via PGxTRIGA.
#define BUCK_VOUT_ADCBUF
ADC input buffer of this ADC channel.
#define BUCK_VOUT_ANSEL
ADC input assignments of output voltage feedback signals.
#define BUCK_VOUT_ADCCORE
0=Dedicated Core #0, 1=Dedicated Core #1, 8=Shared ADC Core
#define BUCK_ISNS_OFFSET_CALIBRATION_ENABLE
Current Sense Offset Calibration is disabled.
#define BUCK_ISNS_FB_OFFSET
#define BUCK_SYNCTHLD_OFF
Phase Current below which the synchronous rectifier will be turned off.
#define BUCK_ISNS_OCL
Over Current Limit.
#define BUCK_SYNCTHLD_ON
Phase Current above which the synchronous rectifier will be turned on.
#define BUCK_ISNS_REF
Output Current Reference.
#define BUCK_ISNS_NORM_FACTOR
ISNS normalization factor scaled in Q15.
#define BUCK_ISNS_ADC_TRGDLY
#define BUCK_ISNS_NORM_SCALER
ISNS normalization
#define BUCK_ISNS_ADCTRIG_PC
Register used for trigger placement in peak current mode control.
#define BUCK_ISNS_ANSEL
GPIO analog function mode enable bit.
#define BUCK_ISNS_TRGSRC
PWM1 (=PG1) Trigger 2 via PGxTRIGB.
#define BUCK_ISNS_ADCCORE
0=Dedicated Core #0, 1=Dedicated Core #1, 2=Shared ADC Core
#define BUCK_ISNS_ADCBUF
ADC input buffer of this ADC channel.
#define BUCK_ISNS_ADCIN
Analog input number (e.g. '5' for 'AN5')
#define TEMP_ADCIN
#define TEMP_ADCCORE
#define TEMP_ADCBUF
GPIO analog function mode enable bit.
#define TEMP_TRGSRC
#define TEMP_ANSEL
GPIO analog function mode enable bit.
#define PWRGOOD_PIN
GPIO port pin declaration where 0=Rx0, 1=Rx1, 2=Rx3, etc.
#define PWRGOOD_PORT
GPIO port declaration where 0=Port RA, 0=Port RB, 0=Port RC, etc.
volatile struct BUCK_CONVERTER_s buck
Global data object for a BUCK CONVERTER.
volatile uint16_t appPowerSupply_PeripheralsInitialize(void)
This function is used to load peripheral configuration templates from the power controller device dri...
volatile uint16_t appPowerSupply_ControllerInitialize(void)
This function initializes the control system feedback loop objects.
volatile uint16_t appPowerSupply_ConverterObjectInitialize(void)
This function initializes the buck converter device driver instance.
volatile uint16_t drv_BuckConverter_Initialize(volatile struct BUCK_CONVERTER_s *buckInstance)
This function initializes all peripheral modules and their instances used by the power controller.
void v_loop_Precharge(volatile struct NPNZ16b_s *controller, volatile fractional ctrl_input, volatile fractional ctrl_output)
Prototype of the Assembly routine '_v_loop_Precharge' loading user-defined values into the NPNZ16b co...
volatile uint16_t v_loop_Initialize(volatile struct NPNZ16b_s *controller)
Initializes controller coefficient arrays and normalization factors.
Definition: v_loop.c:99
void v_loop_Update(volatile struct NPNZ16b_s *controller)
Prototype of the Assembly feedback control loop routine helping to call the v_loop controller from C-...
void v_loop_Reset(volatile struct NPNZ16b_s *controller)
Prototype of the Assembly routine '_v_loop_Reset' clearing the NPNZ16b controller output and error hi...
volatile struct NPNZ16b_s v_loop
External reference to user-defined NPNZ16b controller data object 'v_loop'.
Definition: v_loop.c:86
struct BUCK_CONVERTER_STATUS_s::@126::@128 bits
data structure for single bit addressing operations
volatile uint32_t value
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.
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
volatile uint16_t control_input
BUCK most recent control input value (raw input)
volatile uint16_t v_out
BUCK output voltage.
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.
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
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)
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)
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.
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.
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 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
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.
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.
volatile struct BUCK_GPIO_INSTANCE_s EnableInput
External ENABLE input.
volatile struct BUCK_GPIO_INSTANCE_s PowerGood
Power Good Output.
volatile struct BUCK_SWITCH_NODE_SETTINGS_s sw_node[BUCK_NO_OF_PHASES]
BUCK converter switch node settings.
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.
struct NPNZ_STATUS_s::@132::@134 bits
Controller status bit-field for direct bit access.
volatile fractional NormFactor
Q15 normalization factor.
Definition: npnz16b.h:230
volatile int16_t Offset
Value/signal offset of this port.
Definition: npnz16b.h:231
volatile uint16_t * ptrAddress
Pointer to register or variable where the value is read from (e.g. ADCBUFx) or written to (e....
Definition: npnz16b.h:228
volatile int16_t NormScaler
Bit-shift scaler of the Q15 normalization factor.
Definition: npnz16b.h:229
volatile uint16_t * ptrControlReference
Pointer to global variable of input register holding the controller reference value (e....
Definition: npnz16b.h:265
volatile struct NPNZ_PORT_s AltSource
Secondary data input port declaration.
Definition: npnz16b.h:262
volatile struct NPNZ_PORT_s AltTarget
Secondary data output port declaration.
Definition: npnz16b.h:264
volatile struct NPNZ_PORT_s Target
Primary data output port declaration.
Definition: npnz16b.h:263
volatile struct NPNZ_PORT_s Source
Primary data input port declaration.
Definition: npnz16b.h:261
volatile int16_t MaxOutput
Maximum output value used for clamping (R/W)
Definition: npnz16b.h:330
volatile int16_t AltMinOutput
Alternate minimum output value used for clamping (R/W)
Definition: npnz16b.h:331
volatile int16_t MinOutput
Minimum output value used for clamping (R/W)
Definition: npnz16b.h:329
volatile int16_t AltMaxOutput
Alternate maximum output value used for clamping (R/W)
Definition: npnz16b.h:332
volatile uint16_t * ptrADCTriggerARegister
Pointer to ADC trigger #1 register (e.g. TRIG1)
Definition: npnz16b.h:356
volatile uint16_t * ptrADCTriggerBRegister
Pointer to ADC trigger #2 register (e.g. TRIG2)
Definition: npnz16b.h:358
volatile uint16_t ADCTriggerBOffset
ADC trigger #2 offset to compensate propagation delays.
Definition: npnz16b.h:359
volatile uint16_t ADCTriggerAOffset
ADC trigger #1 offset to compensate propagation delays.
Definition: npnz16b.h:357
volatile uint16_t * ptrDProvControlOutput
Pointer to external data buffer of most recent control output.
Definition: npnz16b.h:386
volatile uint16_t * ptrDProvControlInput
Pointer to external data buffer of most recent, raw control input.
Definition: npnz16b.h:383
volatile uint16_t * ptrDProvControlError
Pointer to external data buffer of most recent control error.
Definition: npnz16b.h:385
volatile uint16_t * ptrDProvControlInputCompensated
Pointer to external data buffer of most recent, compensated control input.
Definition: npnz16b.h:384
volatile uint16_t ptrExtHookPreAntiWindupFunction
Pointer to Function which will be called after the compensation filter computation is complete and be...
Definition: npnz16b.h:418
volatile uint16_t ExtHookPreTargetWriteFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:422
volatile uint16_t ExtHookEndOfLoopFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:425
volatile uint16_t ExtHookPreAntiWindupFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:419
volatile uint16_t ExtHookSourceFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:416
volatile uint16_t ptrExtHookSourceFunction
Pointer to Function which will be called after the source has been read and compensated....
Definition: npnz16b.h:415
volatile uint16_t ptrExtHookPreTargetWriteFunction
Pointer to Function which will be called before the most recent control output is written to target....
Definition: npnz16b.h:421
volatile uint16_t ptrExtHookStartFunction
Pointer to Function which will be called at the beginning of the control loop. This function pointer ...
Definition: npnz16b.h:412
volatile uint16_t ExtHookExitFunctionParam
Parameter of function called (can be a variable or a pointer to a data structure)....
Definition: npnz16b.h:428
volatile uint16_t ptrExtHookEndOfLoopFunction
Pointer to Function which is called at the end of the control loop but will be bypassed when the cont...
Definition: npnz16b.h:424
volatile uint16_t ExtHookStartFunctionParam
Parameter of function called (can be a variable or pointer to a data structure). This parameter is op...
Definition: npnz16b.h:413
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...
Definition: npnz16b.h:427
volatile fractional AgcFactor
Q15 value of Adaptive Gain Modulation factor.
Definition: npnz16b.h:454
volatile fractional AgcMedian
Q15 value of Adaptive Gain Modulation nominal operating point.
Definition: npnz16b.h:455
volatile uint16_t AgcScaler
Bit-shift scaler of Adaptive Gain Modulation factor.
Definition: npnz16b.h:453
volatile uint16_t usrParam6
generic 16-bit wide, user-defined parameter #7 for advanced control options
Definition: npnz16b.h:482
volatile uint16_t usrParam4
generic 16-bit wide, user-defined parameter #5 for advanced control options
Definition: npnz16b.h:480
volatile uint16_t usrParam0
generic 16-bit wide, user-defined parameter #1 for advanced control options
Definition: npnz16b.h:476
volatile uint16_t usrParam7
generic 16-bit wide, user-defined parameter #8 for advanced control options
Definition: npnz16b.h:483
volatile uint16_t usrParam2
generic 16-bit wide, user-defined parameter #3 for advanced control options
Definition: npnz16b.h:478
volatile uint16_t usrParam1
generic 16-bit wide, user-defined parameter #2 for advanced control options
Definition: npnz16b.h:477
volatile uint16_t usrParam3
generic 16-bit wide, user-defined parameter #4 for advanced control options
Definition: npnz16b.h:479
volatile uint16_t usrParam5
generic 16-bit wide, user-defined parameter #6 for advanced control options
Definition: npnz16b.h:481
volatile struct NPNZ_STATUS_s status
Control Loop Status and Control flags.
Definition: npnz16b.h:504
volatile struct NPNZ_GAIN_CONTROL_s GainControl
Parameter section for advanced control options.
Definition: npnz16b.h:507
volatile struct NPNZ_EXTENSION_HOOKS_s ExtensionHooks
User extension function triggers using function pointers with parameters.
Definition: npnz16b.h:511
volatile struct NPNZ_LIMITS_s Limits
Input and output clamping values.
Definition: npnz16b.h:508
volatile struct NPNZ_DATA_PROVIDERS_s DataProviders
Automated data sources pushing recent data points to user-defined variables.
Definition: npnz16b.h:510
volatile struct NPNZ_ADC_TRGCTRL_s ADCTriggerControl
Automatic ADC trigger placement options for ADC Trigger A and B.
Definition: npnz16b.h:509
volatile struct NPNZ_USER_DATA_BUFFER_s Advanced
Parameter section for advanced user control options.
Definition: npnz16b.h:512
volatile struct NPNZ_PORTS_s Ports
Controller input and output ports.
Definition: npnz16b.h:505