ModusToolbox Power Conversion Middleware
All Data Structures Functions Variables Typedefs Modules Pages
Generated Functions

General Description

Functions

cy_rslt_t myPwrConv_init (void)
 Initializes the Power Conversion Control System. More...
 
cy_rslt_t myPwrConv_enable (void)
 Enables the Power Conversion Control System. More...
 
cy_rslt_t myPwrConv_start (void)
 Starts the Power Conversion instance. More...
 
cy_rslt_t pwrconv_start (void)
 Starts all the Power Conversion instances in the project synchronously. More...
 
cy_rslt_t myPwrConv_disable (void)
 Disables (stops) the Power Conversion Control System. More...
 
void myPwrConv_ramp (void)
 Drives the Ramp Generator. More...
 
cy_rslt_t myPwrConv_set_target (uint32_t targ)
 Applies a new target for the Ramp Generator. More...
 
cy_rslt_t myPwrConv_get_state (uint32_t mask)
 Returns the Power Converter instance current state. More...
 
void myPwrConv_scheduled_adc_trigger (void)
 Triggers the scheduled ADC group. More...
 
__STATIC_FORCEINLINE uint32_t myPwrConv_Vout_get_result (void)
 Gets the ADC channel result in raw counts. More...
 
__STATIC_FORCEINLINE int32_t myPwrConv_get_error (uint32_t result)
 Calculates the error value from the feedback and reference values. More...
 

Function Documentation

◆ myPwrConv_init()

cy_rslt_t myPwrConv_init ( void  )

Initializes the Power Conversion Control System.

The instance-based wrapper for data-driven mtb_pwrconv_init.

Returns
The function operation result Status.

◆ myPwrConv_enable()

cy_rslt_t myPwrConv_enable ( void  )

Enables the Power Conversion Control System.

The instance-based wrapper for data-driven mtb_pwrconv_enable.

Returns
The function operation result Status.
Function Usage
#include "cycfg.h"
void scheduler_callback(void)
{
}
int main(void)
{
init_cycfg_all(); /* Initialize everything configured by the Device Configurator */
__enable_irq();
(void) Cy_SysTick_SetCallback(0UL, scheduler_callback);
Cy_SysTick_Enable(); /* A simple scheduled event timer */
myPwrConv_enable(); /* Set target and enable HW */
myPwrConv_start(); /* Start HW */
while (0UL != myPwrConv_get_state(MTB_PWRCONV_STATE_RAMP)); /* Wait while it is ramping to the target */
/* Work with original target (configured in PCC) */
myPwrConv_set_target(4500); /* Change the target to e.g. 4.5V */
/* Now ramping is ended and the converter works with new target */
while (true);
}
void myPwrConv_ramp(void)
Drives the Ramp Generator.
cy_rslt_t myPwrConv_get_state(uint32_t mask)
Returns the Power Converter instance current state.
cy_rslt_t myPwrConv_set_target(uint32_t targ)
Applies a new target for the Ramp Generator.
cy_rslt_t myPwrConv_enable(void)
Enables the Power Conversion Control System.
cy_rslt_t myPwrConv_start(void)
Starts the Power Conversion instance.
#define MTB_PWRCONV_STATE_RAMP
The ramping flag, indicates that the converter currently is changing the reference value smoothly to ...
Definition: mtb_pwrconv.h:233

◆ myPwrConv_start()

cy_rslt_t myPwrConv_start ( void  )

Starts the Power Conversion instance.

The instance-based wrapper for data-driven mtb_pwrconv_start.

Returns
The function operation result Status.
Function Usage
#include "cycfg.h"
void scheduler_callback(void)
{
}
int main(void)
{
init_cycfg_all(); /* Initialize everything configured by the Device Configurator */
__enable_irq();
(void) Cy_SysTick_SetCallback(0UL, scheduler_callback);
Cy_SysTick_Enable(); /* A simple scheduled event timer */
myPwrConv_enable(); /* Set target and enable HW */
myPwrConv_start(); /* Start HW */
while (0UL != myPwrConv_get_state(MTB_PWRCONV_STATE_RAMP)); /* Wait while it is ramping to the target */
/* Work with original target (configured in PCC) */
myPwrConv_set_target(4500); /* Change the target to e.g. 4.5V */
/* Now ramping is ended and the converter works with new target */
while (true);
}

◆ pwrconv_start()

cy_rslt_t pwrconv_start ( void  )

Starts all the Power Conversion instances in the project synchronously.

This non-instance-based function (common for all the instances) initiates the ramp generation and triggers synchronous start of all Power Conversion instances PWMs in the same clock cycle. See Synchronous Start for details.

Returns
The function operation result Status.
Function Usage
/* separately start each instance */
//firstBuck_start();
//secondBuck_start();
/* multi-instance synchronous start */
cy_rslt_t pwrconv_start(void)
Starts all the Power Conversion instances in the project synchronously.

◆ myPwrConv_disable()

cy_rslt_t myPwrConv_disable ( void  )

Disables (stops) the Power Conversion Control System.

The instance-based wrapper for data-driven mtb_pwrconv_disable.

Returns
The function operation result Status.

◆ myPwrConv_ramp()

void myPwrConv_ramp ( void  )

Drives the Ramp Generator.

The instance-based wrapper for the data-driven mtb_pwrconv_ramp.

Function Usage
See Ramp Generator section

◆ myPwrConv_set_target()

cy_rslt_t myPwrConv_set_target ( uint32_t  targ)

Applies a new target for the Ramp Generator.

The instance-based wrapper for data-driven mtb_pwrconv_set_target.

Parameters
[in]targThe target value to be set. The valid range is defined by mtb_stc_pwrconv_t::targMin and mtb_stc_pwrconv_t::targMax.
Returns
The function operation result Status.
Function Usage
See Ramp Generator section

◆ myPwrConv_get_state()

cy_rslt_t myPwrConv_get_state ( uint32_t  mask)

Returns the Power Converter instance current state.

The instance-based wrapper for the data-driven mtb_pwrconv_get_state.

Parameters
[in]maskThe mask to get one or more specified power converter States.
Returns
The power converter state States.
Function Usage
#include "cycfg.h"
void scheduler_callback(void)
{
}
int main(void)
{
init_cycfg_all(); /* Initialize everything configured by the Device Configurator */
__enable_irq();
(void) Cy_SysTick_SetCallback(0UL, scheduler_callback);
Cy_SysTick_Enable(); /* A simple scheduled event timer */
myPwrConv_enable(); /* Set target and enable HW */
myPwrConv_start(); /* Start HW */
while (0UL != myPwrConv_get_state(MTB_PWRCONV_STATE_RAMP)); /* Wait while it is ramping to the target */
/* Work with original target (configured in PCC) */
myPwrConv_set_target(4500); /* Change the target to e.g. 4.5V */
/* Now ramping is ended and the converter works with new target */
while (true);
}

◆ myPwrConv_scheduled_adc_trigger()

void myPwrConv_scheduled_adc_trigger ( void  )

Triggers the scheduled ADC group.

The instance-based function to trigger the scheduled ADC group, if such is configured by the Power Conversion Configurator.

Function Usage
void scheduler_callback(void)
{
}
void myPwrConv_scheduled_adc_callback(void)
{
if (myPwrConv_Temp_MAX < myPwrConv_Temp_get_result())
{
myPwrConv_disable(); /* Emergency stop for overheat protection */
}
}
void myPwrConv_scheduled_adc_trigger(void)
Triggers the scheduled ADC group.
cy_rslt_t myPwrConv_disable(void)
Disables (stops) the Power Conversion Control System.

◆ myPwrConv_Vout_get_result()

__STATIC_FORCEINLINE uint32_t myPwrConv_Vout_get_result ( void  )

Gets the ADC channel result in raw counts.

The instance-based ADC-channel-based function to get the ADC channel result directly from the register. This function exists for each PwrConv ADC channel, under the naming: [instance_name]_[channel_name]_get_result.

Returns
The ADC channel result value
Note
In Infineon Control Loop mode, for the feedback ADC channel (Vout by default), this function gets the value from the mtb_stc_pwrconv_ctx_t::res instead of the ADC register. See section Infineon Control Loop for details.
Function Usage
__STATIC_INLINE void myPwrConv_custom_callback(void)
{
static float32_t modAvg = 0.0;
myPwrConv_ctx.res = myPwrConv_Vout_get_result(); /* Retrieving the feedback value */
modAvg = 0.99 * modAvg + 0.01 * myPwrConv_get_error(); /* The simplest first-order regulator */
modAvg = (modAvg < myPwrConv_SLOPE_START_MIN) ? myPwrConv_SLOPE_START_MIN : /* Anti-windup limitation */
(modAvg > myPwrConv_SLOPE_START_MAX) ? myPwrConv_SLOPE_START_MAX : modAvg;
myPwrConv.ctx->mod = (int32_t)modAvg; /* Update modulator */
}
__STATIC_FORCEINLINE uint32_t myPwrConv_Vout_get_result(void)
Gets the ADC channel result in raw counts.
__STATIC_FORCEINLINE int32_t myPwrConv_get_error(uint32_t result)
Calculates the error value from the feedback and reference values.

◆ myPwrConv_get_error()

__STATIC_FORCEINLINE int32_t myPwrConv_get_error ( uint32_t  result)

Calculates the error value from the feedback and reference values.

The instance-based wrapper for the data-driven mtb_pwrconv_get_error.

Parameters
[in]resultThe feedback measurement result
Returns
The error value, also saved into the mtb_stc_pwrconv_ctx_t::err
Function Usage
__STATIC_INLINE void myPwrConv_custom_callback(void)
{
static float32_t modAvg = 0.0;
myPwrConv_ctx.res = myPwrConv_Vout_get_result(); /* Retrieving the feedback value */
modAvg = 0.99 * modAvg + 0.01 * myPwrConv_get_error(); /* The simplest first-order regulator */
modAvg = (modAvg < myPwrConv_SLOPE_START_MIN) ? myPwrConv_SLOPE_START_MIN : /* Anti-windup limitation */
(modAvg > myPwrConv_SLOPE_START_MAX) ? myPwrConv_SLOPE_START_MAX : modAvg;
myPwrConv.ctx->mod = (int32_t)modAvg; /* Update modulator */
}