The MCUXpresso SDK provides a peripheral driver for the DCDC Converter (DCDC) module of MCUXpresso SDK devices.
This section describes the programming interface of the DCDC Converter Peripheral driver.
The DCDC converter module is a switching mode DC-DC converter supporting Buck, Boost, and Bypass mode. It can produce multiple switching outputs for SoC peripherals and external devices with high conversion efficiency. The converter can be operated in continuous or pulsed mode.
As a module to provide the power for hardware system, the DCDC would start working when the system is powered up before the software takes over the SoC. Some important configurations, like selecting BUCK/BOOST/BYPASS mode, is done in the board settings. Before the software can access the DCDC's registers, DCDC are already working normally with the default settings.
However, if the application needs to improve the DCDC's performance or change the default settings, DCDC driver would help. The DCDC's register can not be accessed by software before its initialization (open the clock gate). Then user can configure the hardware according to the application guide from RM.
Function groups
Initialization and deinitialization
This function group is to enable/disable the operations to DCDC module through the driver.
Status
Provides functions to get and clear the DCDC status.
Interrupts
Provides functions to enable/disable DCDC interrupts.
Misc control
Provides functions to set the DCDC's miscellaneous control.
Application guideline
Continuous mode
As guideline from RM, to have better efficiency and ripple. The following call is recommended:
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/dcdc In boost mode, POSLIMIT_BOOST_IN is set to small value by default. To limit startup voltage, set it to 0x12 after startup, to provide high current to output, especially when battery voltage is low. The following call could be used.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/dcdc
Target voltage adjustment
To adjust target voltage of VDD1P8 and VDD1P5. The following code could be used:
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/dcdc
Pulsed mode
Before entering pulsed mode, the target voltage should be locked. Also, there are some recommended setting.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/dcdc
|
enum | _dcdc_status_flags_t {
kDCDC_LockedOKStatus = (1U << 0),
kDCDC_PSwitchStatus = (1U << 1),
kDCDC_PSwitchInterruptStatus = (1U << 2)
} |
| Status flags. More...
|
|
enum | _dcdc_interrupt_enable_t { kDCDC_PSwitchEdgeDetectInterruptEnable = DCDC_REG6_PSWITCH_INT_MUTE_MASK
} |
| Interrupts. More...
|
|
enum | _dcdc_pswitch_detect_event_t {
kDCDC_PSwitchFallingEdgeDetectEnable = DCDC_REG6_PSWITCH_INT_FALL_EN_MASK,
kDCDC_PSwitchRisingEdgeDetectEnable = DCDC_REG6_PSWITCH_INT_RISE_EN_MASK
} |
| Events for PSWITCH signal(pin). More...
|
|
enum | dcdc_work_mode_t {
kDCDC_WorkInContinuousMode = 0U,
kDCDC_WorkInPulsedMode = 1U
} |
| DCDC work mode in SoC's low power condition. More...
|
|
enum | dcdc_hysteretic_threshold_offset_value_t {
kDCDC_HystereticThresholdOffset0mV = 0U,
kDCDC_HystereticThresholdOffset25mV = 1U,
kDCDC_HystereticThresholdOffset50mV = 2U,
kDCDC_HystereticThresholdOffset75mV = 3U
} |
| Hysteretic upper/lower threshold value in low power mode. More...
|
|
enum | dcdc_vbat_divider_t {
kDCDC_VBatVoltageDividerOff = 0U,
kDCDC_VBatVoltageDivider1 = 1U,
kDCDC_VBatVoltageDivider2 = 2U,
kDCDC_VBatVoltageDivider4 = 3U
} |
| VBAT voltage divider. More...
|
|
enum | dcdc_clock_source_t { kDCDC_ClockAutoSwitch = 0U
} |
| Oscillator clock option. More...
|
|
|
void | DCDC_GetDefaultLowPowerConfig (dcdc_low_power_config_t *config) |
| Get the default setting for low power configuration. More...
|
|
void | DCDC_SetLowPowerConfig (DCDC_Type *base, const dcdc_low_power_config_t *config) |
| Configure the low power for DCDC. More...
|
|
void | DCDC_GetDefaultLoopControlConfig (dcdc_loop_control_config_t *config) |
| Get the default setting for loop control configuration. More...
|
|
void | DCDC_SetLoopControlConfig (DCDC_Type *base, const dcdc_loop_control_config_t *config) |
| Configure the loop control for DCDC. More...
|
|
static void | DCDC_EnableXtalOKDetectionCircuit (DCDC_Type *base, bool enable) |
| Enable the XTAL OK detection circuit. More...
|
|
static void | DCDC_EnableOutputRangeComparator (DCDC_Type *base, bool enable) |
| Enable the output range comparator. More...
|
|
static void | DCDC_EnableReduceCurrent (DCDC_Type *base, bool enable) |
| Enable to reduce the DCDC current. More...
|
|
void | DCDC_SetClockSource (DCDC_Type *base, dcdc_clock_source_t clockSource) |
| Set the clock source for DCDC. More...
|
|
static void | DCDC_SetBatteryVoltageDivider (DCDC_Type *base, dcdc_vbat_divider_t divider) |
| Set the battery voltage divider for ADC sample. More...
|
|
void | DCDC_SetBatteryMonitorValue (DCDC_Type *base, uint32_t battValue) |
| Set battery monitor value. More...
|
|
static void | DCDC_DoSoftShutdown (DCDC_Type *base) |
| Software shutdown the DCDC module to stop the power supply for chip. More...
|
|
static void | DCDC_SetUpperLimitDutyCycleBuck (DCDC_Type *base, uint32_t value) |
| Set upper limit duty cycle limit in DCDC converter in Buck mode. More...
|
|
static void | DCDC_AdjustDutyCycleSwitchingTargetOutput (DCDC_Type *base, uint32_t value) |
| Adjust value of duty cycle when switching between VDD1P45 and VDD1P8. More...
|
|
static void | DCDC_LockTargetVoltage (DCDC_Type *base) |
| Lock the setting of target voltage. More...
|
|
void | DCDC_AdjustTargetVoltage (DCDC_Type *base, uint32_t vdd1p5xBuck, uint32_t vdd1p8) |
| Adjust the target voltage of DCDC output. More...
|
|
void | DCDC_GetDefaultMinPowerDefault (dcdc_min_power_config_t *config) |
| Get the default configuration for min power. More...
|
|
void | DCDC_SetMinPowerConfig (DCDC_Type *base, const dcdc_min_power_config_t *config) |
| Configure for the min power. More...
|
|
void | DCDC_GetDefaultPulsedIntegratorConfig (dcdc_pulsed_integrator_config_t *config) |
| Get the default setting for integrator configuration in pulsed mode. More...
|
|
void | DCDC_SetPulsedIntegratorConfig (DCDC_Type *base, const dcdc_pulsed_integrator_config_t *config) |
| Configure the integrator in pulsed mode. More...
|
|
struct dcdc_low_power_config_t |
bool dcdc_low_power_config_t::enableHysteresisVoltageSense |
bool dcdc_low_power_config_t::enableAdjustHystereticValueSense |
bool dcdc_low_power_config_t::enableHystersisComparator |
bool dcdc_low_power_config_t::enableAdjustHystereticValueComparator |
bool dcdc_low_power_config_t::enableDiffComparators |
struct dcdc_loop_control_config_t |
bool dcdc_loop_control_config_t::enableDiffHysteresis |
This feature improves transient supply ripple and efficiency.
bool dcdc_loop_control_config_t::enableCommonHysteresis |
This feature improves transient supply ripple and efficiency.
bool dcdc_loop_control_config_t::enableDiffHysteresisThresh |
However, if this field is enabled along with the enableDiffHysteresis, the Hysteresis wuold be doubled.
bool dcdc_loop_control_config_t::enableCommonHysteresisThresh |
However, if this field is enabled along with the enableCommonHysteresis, the Hysteresis wuold be doubled.
bool dcdc_loop_control_config_t::enableInvertHysteresisSign |
struct dcdc_min_power_config_t |
bool dcdc_min_power_config_t::enableUseHalfFetForContinuous |
bool dcdc_min_power_config_t::enableUseDoubleFetForContinuous |
bool dcdc_min_power_config_t::enableUseHalfFreqForContinuous |
bool dcdc_min_power_config_t::enableUseHalfFetForPulsed |
bool dcdc_min_power_config_t::enableUseDoubleFetForPulsed |
bool dcdc_min_power_config_t::enableUseHalfFreqForPulsed |
struct dcdc_pulsed_integrator_config_t |
bool dcdc_pulsed_integrator_config_t::enableUseUserIntegratorValue |
Otherwise, the predefined hardware setting would be applied internally.
uint32_t dcdc_pulsed_integrator_config_t::userIntegratorValue |
The available value is 19-bit.
bool dcdc_pulsed_integrator_config_t::enablePulseRunSpeedup |
Enumerator |
---|
kDCDC_LockedOKStatus |
Status to indicate DCDC lock.
Read only bit.
|
kDCDC_PSwitchStatus |
Status to indicate PSWITCH signal.
Read only bit.
|
kDCDC_PSwitchInterruptStatus |
PSWITCH edge detection interrupt status.
|
Enumerator |
---|
kDCDC_PSwitchEdgeDetectInterruptEnable |
Enable the edge detect interrupt.
|
Enumerator |
---|
kDCDC_PSwitchFallingEdgeDetectEnable |
Enable falling edge detect.
|
kDCDC_PSwitchRisingEdgeDetectEnable |
Enable rising edge detect.
|
Enumerator |
---|
kDCDC_WorkInContinuousMode |
DCDC works in continuous mode when SOC is in low power mode.
|
kDCDC_WorkInPulsedMode |
DCDC works in pulsed mode when SOC is in low power mode.
|
Enumerator |
---|
kDCDC_HystereticThresholdOffset0mV |
Target voltage value +/- 0mV.
|
kDCDC_HystereticThresholdOffset25mV |
Target voltage value +/- 25mV.
|
kDCDC_HystereticThresholdOffset50mV |
Target voltage value +/- 50mV.
|
kDCDC_HystereticThresholdOffset75mV |
Target voltage value +/- 75mV.
|
Enumerator |
---|
kDCDC_VBatVoltageDividerOff |
The sensor signal is disabled.
|
kDCDC_VBatVoltageDivider1 |
VBat.
|
kDCDC_VBatVoltageDivider2 |
VBat/2.
|
kDCDC_VBatVoltageDivider4 |
VBat/4.
|
Enumerator |
---|
kDCDC_ClockAutoSwitch |
Automatic clock switch from internal oscillator to external clock.
|
void DCDC_Init |
( |
DCDC_Type * |
base | ) |
|
- Parameters
-
base | DCDC peripheral base address. |
void DCDC_Deinit |
( |
DCDC_Type * |
base | ) |
|
- Parameters
-
base | DCDC peripheral base address. |
uint32_t DCDC_GetStatusFlags |
( |
DCDC_Type * |
base | ) |
|
base DCDC peripheral base address.
- Returns
- Masks of asserted status flags. See to "_dcdc_status_flags_t".
void DCDC_ClearStatusFlags |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
base DCDC peripheral base address. mask Mask of status values that would be cleared. See to "_dcdc_status_flags_t".
static void DCDC_EnableInterrupts |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | DCDC peripheral base address. |
mask | Mask of interrupt events that would be enabled. See to "_dcdc_interrupt_enable_t". |
static void DCDC_DisableInterrupts |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | DCDC peripheral base address. |
mask | Mask of interrupt events that would be disabled. See to "_dcdc_interrupt_enable_t". |
void DCDC_SetPSwitchInterruptConfig |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
There are PSWITCH interrupt events can be triggered by falling edge or rising edge. So user can set the interrupt events that would be triggered with this function. Un-asserted events would be disabled. The interrupt of PSwitch should be enabled as well if to sense the PSWTICH event. By default, no interrupt events would be enabled.
- Parameters
-
base | DCDC peripheral base address. |
mask | Mask of interrupt events for PSwtich. See to "_dcdc_pswitch_detect_event_t". |
The default configuration are set according to responding registers' setting when powered on. They are:
* config->enableHysteresisVoltageSense = true;
* config->enableAdjustHystereticValueSense = false;
* config->enableHystersisComparator = true;
* config->enableAdjustHystereticValueComparator = false;
* config->enableDiffComparators = false;
*
- Parameters
-
config | Pointer to configuration structure. See to "dcdc_low_power_config_t". |
- Parameters
-
base | DCDC peripheral base address. |
config | Pointer to configuration structure. See to "dcdc_low_power_config_t". |
The default configuration are set according to responding registers' setting when powered on. They are:
* config->enableDiffHysteresis = false;
* config->enableCommonHysteresis = false;
* config->enableDiffHysteresisThresh = false;
* config->enableCommonHysteresisThresh = false;
* config->enableInvertHysteresisSign = false;
*
- Parameters
-
config | Pointer to configuration structure. See to "dcdc_loop_control_config_t". |
- Parameters
-
base | DCDC peripheral base address. |
config | Pointer to configuration structure. See to "dcdc_loop_control_config_t". |
static void DCDC_EnableXtalOKDetectionCircuit |
( |
DCDC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
The XTAL OK detection circuit is enabled by default.
- Parameters
-
base | DCDC peripheral base address. |
enable | Enable the feature or not. |
static void DCDC_EnableOutputRangeComparator |
( |
DCDC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
The output range comparator is enabled by default.
- Parameters
-
base | DCDC peripheral base address. |
enable | Enable the feature or not. |
static void DCDC_EnableReduceCurrent |
( |
DCDC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
To enable this feature will save approximately 20 µA in RUN mode. This feature is disabled by default.
- Parameters
-
base | DCDC peripheral base address. |
enable | Enable the feature or not. |
This function is to set the clock source for DCDC. By default, DCDC can switch the clock from internal oscillator to external clock automatically. Once the application choose to use the external clock with function, the internal oscillator would be powered down. However, the internal oscillator could be powered down only when 32MHz crystal oscillator is available.
- Parameters
-
base | DCDC peripheral base address. |
clockSource | Clock source for DCDC. See to "dcdc_clock_source_t". |
This function controls VBAT voltage divider. The divided VBAT output is input to an ADC channel which allows the battery voltage to be measured.
- Parameters
-
base | DCDC peripheral base address. |
divider | Setting divider selection. See to "dcdc_vbat_divider_t" |
void DCDC_SetBatteryMonitorValue |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
battValue |
|
) |
| |
This function is to set the battery monitor value. If the feature of monitoring battery voltage is enabled (with non-zero value set), user should set the battery voltage measured with an 8 mV LSB resolution from the ADC sample channel. It would improve efficiency and minimize ripple.
- Parameters
-
base | DCDC peripheral base address. |
battValue | Battery voltage measured with an 8 mV LSB resolution with 10-bit ADC sample. Setting 0x0 would disable feature of monitoring battery voltage. |
static void DCDC_DoSoftShutdown |
( |
DCDC_Type * |
base | ) |
|
|
inlinestatic |
This function is to shutdown the DCDC module and stop the power supply for chip. In case the chip is powered by DCDC, which means the DCDC is working as Buck/Boost mode, to shutdown the DCDC would cause the chip to reset! Then, the DCDC_REG4_DCDC_SW_SHUTDOWN bit would be cleared automatically during power up sequence. If the DCDC is in bypass mode, which depends on the board's hardware connection, to shutdown the DCDC would not be meaningful.
- Parameters
-
base | DCDC peripheral base address. |
static void DCDC_SetUpperLimitDutyCycleBuck |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
value |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | DCDC peripheral base address. |
value | Setting value for limit duty cycle. Available range is 0-127. |
static void DCDC_AdjustDutyCycleSwitchingTargetOutput |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
value |
|
) |
| |
|
inlinestatic |
Adjust value of duty cycle when switching between VDD1P45 and VDD1P8. The unit is 1/32 or 3.125%.
- Parameters
-
base | DCDC peripheral base address. |
value | Setting adjust value. The available range is 0-15. The unit is 1/32 or 3.125&. |
static void DCDC_LockTargetVoltage |
( |
DCDC_Type * |
base | ) |
|
|
inlinestatic |
This function is to lock the setting of target voltage. This function should be called before entering the low power modes to lock the target voltage.
- Parameters
-
base | DCDC peripheral base address. |
void DCDC_AdjustTargetVoltage |
( |
DCDC_Type * |
base, |
|
|
uint32_t |
vdd1p5xBuck, |
|
|
uint32_t |
vdd1p8 |
|
) |
| |
This function is to adjust the target voltage of DCDC output. It would unlock the setting of target voltages, change them and finally wait until the output is stabled.
- Parameters
-
base | DCDC peripheral base address. |
vdd1p5xBuck | Target value of VDD1P5X in buck mode, 25 mV each step from 0x00 to 0x0F. 0x00 is for 1.275V. |
vdd1p8 | Target value of VDD1P8, 25 mV each step in two ranges, from 0x00 to 0x11 and 0x20 to 0x3F. 0x00 is for 1.65V, 0x20 is for 2.8V. |
The default configuration are set according to responding registers' setting when powered on. They are:
* config->enableUseHalfFetForContinuous = false;
* config->enableUseDoubleFetForContinuous = false;
* config->enableUseHalfFreqForContinuous = false;
* config->enableUseHalfFetForPulsed = false;
* config->enableUseDoubleFetForPulsed = false;
* config->enableUseHalfFreqForPulsed = false;
*
- Parameters
-
config | Pointer to configuration structure. See to "dcdc_min_power_config_t". |
- Parameters
-
base | DCDC peripheral base address. |
config | Pointer to configuration structure. See to "dcdc_min_power_config_t". |
The default configuration are set according to responding registers' setting when powered on. They are:
* config->enableUseUserIntegratorValue = false;
* config->userIntegratorValue = 0U;
* config->enablePulseRunSpeedup = false;
*
- Parameters
-
config | Pointer to configuration structure. See to "dcdc_pulsed_integrator_config_t". |
- Parameters
-
base | DCDC peripheral base address. Pointer to configuration structure. See to "dcdc_pulsed_integrator_config_t". |