BUCK

group npmx_buck

Buck converter (DC/DC step-down converter) peripheral driver.

Enums

enum npmx_buck_task_t

Buck tasks.

Values:

enumerator NPMX_BUCK_TASK_ENABLE

Enable buck.

enumerator NPMX_BUCK_TASK_DISABLE

Disable buck.

enumerator NPMX_BUCK_TASK_ENABLE_PWM

Enable PWM mode for buck.

enumerator NPMX_BUCK_TASK_DISABLE_PWM

Disable PWM mode for buck.

enumerator NPMX_BUCK_TASK_COUNT

Buck tasks count.

enum npmx_buck_mode_t

Possible converter modes of each buck.

Values:

enumerator NPMX_BUCK_MODE_AUTO

AUTO converter mode, PWM or hysteretic (PFM).

enumerator NPMX_BUCK_MODE_PFM

Force hysteretic (PFM) converter mode.

enumerator NPMX_BUCK_MODE_PWM

Force PWM converter mode.

enumerator NPMX_BUCK_MODE_COUNT

Buck modes count.

enumerator NPMX_BUCK_MODE_INVALID

Invalid buck mode.

enum npmx_buck_vout_select_t

The source of VOUT voltage reference. Output voltage can be controlled by external VSETx feedback pin or by software register value.

Values:

enumerator NPMX_BUCK_VOUT_SELECT_VSET_PIN

Allow VSET pins to set VOUT.

enumerator NPMX_BUCK_VOUT_SELECT_SOFTWARE

Allow software to override VSET pin.

enumerator NPMX_BUCK_VOUT_SELECT_COUNT

VOUT source configs count.

enumerator NPMX_BUCK_VOUT_SELECT_INVALID

Invalid VOUT source config.

enum npmx_buck_voltage_t

Possible buck output voltages to be set.

Values:

enumerator NPMX_BUCK_VOLTAGE_1V0

1.0 V

enumerator NPMX_BUCK_VOLTAGE_1V1

1.1 V

enumerator NPMX_BUCK_VOLTAGE_1V2

1.2 V

enumerator NPMX_BUCK_VOLTAGE_1V3

1.3 V

enumerator NPMX_BUCK_VOLTAGE_1V4

1.4 V

enumerator NPMX_BUCK_VOLTAGE_1V5

1.5 V

enumerator NPMX_BUCK_VOLTAGE_1V6

1.6 V

enumerator NPMX_BUCK_VOLTAGE_1V7

1.7 V

enumerator NPMX_BUCK_VOLTAGE_1V8

1.8 V

enumerator NPMX_BUCK_VOLTAGE_1V9

1.9 V

enumerator NPMX_BUCK_VOLTAGE_2V0

2.0 V

enumerator NPMX_BUCK_VOLTAGE_2V1

2.1 V

enumerator NPMX_BUCK_VOLTAGE_2V2

2.2 V

enumerator NPMX_BUCK_VOLTAGE_2V3

2.3 V

enumerator NPMX_BUCK_VOLTAGE_2V4

2.4 V

enumerator NPMX_BUCK_VOLTAGE_2V5

2.5 V

enumerator NPMX_BUCK_VOLTAGE_2V6

2.6 V

enumerator NPMX_BUCK_VOLTAGE_2V7

2.7 V

enumerator NPMX_BUCK_VOLTAGE_2V8

2.8 V

enumerator NPMX_BUCK_VOLTAGE_2V9

2.9 V

enumerator NPMX_BUCK_VOLTAGE_3V0

3.0 V

enumerator NPMX_BUCK_VOLTAGE_3V1

3.1 V

enumerator NPMX_BUCK_VOLTAGE_3V2

3.2 V

enumerator NPMX_BUCK_VOLTAGE_3V3

3.3 V

enumerator NPMX_BUCK_VOLTAGE_COUNT

Possible voltages count.

enumerator NPMX_BUCK_VOLTAGE_MAX

Maximum voltage.

enumerator NPMX_BUCK_VOLTAGE_INVALID

Invalid voltage.

enum npmx_buck_gpio_t

Possible GPIO to be selected with buck configurations.

Values:

enumerator NPMX_BUCK_GPIO_NC

Not used.

enumerator NPMX_BUCK_GPIO_0

GPI_0 selected.

enumerator NPMX_BUCK_GPIO_1

GPI_1 selected.

enumerator NPMX_BUCK_GPIO_2

GPI_2 selected.

enumerator NPMX_BUCK_GPIO_3

GPI_3 selected.

enumerator NPMX_BUCK_GPIO_4

GPI_4 selected.

enumerator NPMX_BUCK_GPIO_NC1

No GPI selected.

enumerator NPMX_BUCK_GPIO_COUNT

GPIO configs count.

enumerator NPMX_BUCK_GPIO_INVALID

Invalid BUCK GPIO.

Functions

npmx_buck_t *npmx_buck_get(npmx_instance_t *p_pmic, uint8_t idx)

Function for returning buck instance based on index.

Parameters:
  • p_pmic[in] Pointer to the PMIC instance.

  • idx[in] Index of the buck instance.

Returns:

Pointer to the buck instance.

npmx_buck_voltage_t npmx_buck_voltage_convert(uint32_t millivolts)

Function for converting millivolts to npmx_buck_voltage_t enumeration.

Parameters:
  • millivolts[in] Voltage in millivolts to be converted into npmx_buck_voltage_t enumeration.

Returns:

Result of conversion. NPMX_BUCK_VOLTAGE_INVALID if given voltage is not represented in enumeration.

bool npmx_buck_voltage_convert_to_mv(npmx_buck_voltage_t enum_value, uint32_t *p_val)

Function for converting npmx_buck_voltage_t enumeration to millivolts.

Parameters:
  • enum_value[in] Voltage defined as npmx_buck_voltage_t enumeration to be converted into millivolts.

  • p_val[out] Pointer to the variable that stores the conversion result.

Return values:
  • true – Conversion is valid.

  • false – Conversion is invalid - an invalid argument was passed to the function.

npmx_error_t npmx_buck_task_trigger(npmx_buck_t const *p_instance, npmx_buck_task_t task)

Function for activating the specified buck task.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • task[in] Task to be activated.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_converter_mode_set(npmx_buck_t const *p_instance, npmx_buck_mode_t mode)

Function for setting the buck converter mode to either PWM, hysteretic (PFM) or AUTO (PWM & PFM).

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • mode[in] PWM, hysteretic (PFM) or AUTO mode.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_pfm_enable_get(npmx_buck_t const *p_instance, bool *p_enable)

Function for checking whether the hysteretic (PFM) mode of the buck converter is enabled.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_enable[out] Pointer to variable to be filled with hysteretic (PFM) mode. True if mode is enabled, false otherwise.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_normal_voltage_set(npmx_buck_t const *p_instance, npmx_buck_voltage_t voltage)

Function for setting the normal voltage of the specified buck instance.

Note

To apply the voltage in nPM device, call npmx_buck_vout_select_set() function with NPMX_BUCK_VOUT_SELECT_SOFTWARE value.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • voltage[in] Voltage to be set at buck’s output.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_normal_voltage_get(npmx_buck_t const *p_instance, npmx_buck_voltage_t *p_voltage)

Function for reading the normal voltage of the specified buck instance.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_voltage[out] Pointer to buck voltage variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_retention_voltage_set(npmx_buck_t const *p_instance, npmx_buck_voltage_t voltage)

Function for setting the buck retention voltage for the specified buck instance.

Note

Entering retention mode is done by toggling the selected GPIO npmx_buck_retention_gpio_config_set(). Returning to normal mode is done by toggling GPIO again.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • voltage[in] Voltage to be set at buck’s output.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_retention_voltage_get(npmx_buck_t const *p_instance, npmx_buck_voltage_t *p_voltage)

Function for reading the buck retention voltage for the specified buck instance.

Note

Entering retention mode is done by toggling the selected GPIO npmx_buck_retention_gpio_config_set(). Returning to normal mode is done by toggling GPIO again.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_voltage[out] Pointer to buck voltage variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_enable_gpio_config_set(npmx_buck_t const *p_instance, npmx_buck_gpio_config_t const *p_config)

Function for configuring the GPIO pin which will be used for enabling and disabling the specified buck instance converter.

Note

Selected GPIO should be configured as input using GPIO driver.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_config[in] Pointer to the configuration of GPIO to be applied.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_enable_gpio_config_get(npmx_buck_t const *p_instance, npmx_buck_gpio_config_t *p_config)

Function for reading configuration of the GPIO pin used for enabling and disabling the specified buck instance converter.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_config[out] Pointer to the configuration of GPIO.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_retention_gpio_config_set(npmx_buck_t const *p_instance, npmx_buck_gpio_config_t const *p_config)

Function for configuring the GPIO pin which will be used for controlling the specified buck’s retention mode.

Note

Selected GPIO should be configured as input using GPIO driver.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_config[in] Pointer to the configuration of GPIO to be applied.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_retention_gpio_config_get(npmx_buck_t const *p_instance, npmx_buck_gpio_config_t *p_config)

Function for reading configuration of the GPIO pin used for controlling the specified buck’s retention mode.

Note

Selected GPIO should be configured as input using GPIO driver.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_config[out] Pointer to the configuration of GPIO.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_forced_pwm_gpio_config_set(npmx_buck_t const *p_instance, npmx_buck_gpio_config_t const *p_config)

Function for configuring the GPIO pin to use forced PWM mode in the specified buck instance converter.

Note

Selected GPIO should be configured as input using GPIO driver. When GPIO has been configured for this purpose, it overrides the register setting for either one or both converters.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_config[in] Pointer to the configuration of GPIO to be applied.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_forced_pwm_gpio_config_get(npmx_buck_t const *p_instance, npmx_buck_gpio_config_t *p_config)

Function for reading the GPIO pin configuration used to force PWM mode.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_config[out] Pointer to the configuration structure.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_vout_select_set(npmx_buck_t const *p_instance, npmx_buck_vout_select_t selection)

Function for selecting the output voltage reference of the specified buck instance converter.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • selection[in] Selection of the output voltage reference.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_vout_select_get(npmx_buck_t const *p_instance, npmx_buck_vout_select_t *p_selection)

Function for reading selected output voltage reference of the specified buck instance converter.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_selection[out] Pointer to selection of the output voltage reference.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_status_voltage_get(npmx_buck_t const *p_instance, npmx_buck_voltage_t *p_voltage)

Function for reading the voltage status register of the specified buck instance.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_voltage[out] Pointer to the voltage variable of the buck.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_active_discharge_enable_set(npmx_buck_t const *p_instance, bool enable)

Function for setting active output capacitor discharge state of the specified buck converter. When selected, discharge is ON when converter is disabled.

Note

Discharge of the capacitor is forced automatically by nPM device in case of a power cycle reset.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • enable[in] True to enable active discharge, false to disable active discharge.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_active_discharge_enable_get(npmx_buck_t const *p_instance, bool *p_enable)

Function for reading active output capacitor discharge state of the specified buck converter. When selected, discharge is ON when converter is disabled.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_enable[out] Pointer to the enable active discharge variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_buck_status_get(npmx_buck_t const *p_instance, npmx_buck_status_t *p_status)

Function for getting status of the specified buck converter.

Parameters:
  • p_instance[in] Pointer to the buck instance.

  • p_status[out] Pointer to the buck status structure.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

struct npmx_buck_t
#include <npmx_buck.h>

Data structure of the buck converter (BUCK) driver instance.

Public Members

npmx_backend_t *p_backend

Pointer to backend instance.

uint8_t hw_index

Hardware index of buck instance.

struct npmx_buck_gpio_config_t
#include <npmx_buck.h>

Configuration structure for GPIO used as input signal for buck.

Public Members

npmx_buck_gpio_t gpio

The GPIO to be used as the signal.

bool inverted

If true, the GPI state will be inverted, logical low will activate the signal.

struct npmx_buck_status_t
#include <npmx_buck.h>

Buck status structure.

Public Members

npmx_buck_mode_t buck_mode

Buck mode.

bool powered

True if buck is powered on, false otherwise.

bool pwm_enabled

True if PWM mode is enabled, false otherwise.