MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
MCX_VBAT: Smart Power Switch

Overview

The MCUXpresso SDK provides a peripheral driver for the Smart Power Switch (VBAT) block of MCUXpresso SDK devices. The VBAT includes the following features:

Based on VBAT's features the VBAT driver are divided into 6 function groups.

FRO16K Control Interfaces

Functions in this group can be used to configure internal 16kHz free running oscillator.

To enable and lock the FRO16K:

  1. Invoke VBAT_EnableFRO16k(VBAT0, true) to enable FRO16K;
  2. Invoke VBAT_LockFRO16kSettings(VBAT0) to lock FRO16K settings;
  3. Invoke VBAT_UngateFRO16k(VBAT0, kVBAT_EnableClockToVddBat | kVBAT_EnableClockToVddSys) to ungate clock to VDD_BAT power domain and VDD_SYS power domain.

OSC32K Control Interfaces

Functions in this group can be used to configure internal 32k crystal oscillator.

To configure and lock OSC32kHz for lowest power operation(Switched mode):

  1. Invoke VBAT_SetCrystalOsc32kModeAndLoadCapacitance(VBAT0, kVBAT_Osc32kEnabledToLowPowerSwitchedMode, kVBAT_Osc32kCrystalLoadCap0pF, kVBAT_Osc32kCrystalLoadCap0pF) to set OSC32k as low power switched mode.
  2. Invoke VBAT_EnableCrystalOsc32k(VBAT0, true) to enable OSC32kHz.
  3. Invoke VBAT_LookOsc32kSettings(VBAT0) to lock OSC32k settings.
  4. Invoke VBAT_UngateOsc32k(VBAT0, kVBAT_EnableClockToVddBat | kVBAT_EnableClockToVddSys) to ungate clock to VDD_BAT power domain and VDD_SYS power domain.

RAM_LDO Control Interfaces

Functions in this group can be used to control internal bandgap and RAM_LDO.

To enable and lock the LDO and bandgap:

  1. Check if FRO16k is enabled by invoking VBAT_CheckFRO16kEnabled(VBAT0).
  2. Invoke VBAT_EnableBandgap(VBAT0, true) to enable bandgap.
  3. Invoke VBAT_EnableBandgapRefreshMode(VBAT0, true) to enable bandgap low power refresh mode.
  4. Invoke VBAT_EnableBackupSRAMRegulator(VBAT0, true) to enable backup SRAM regulator.
  5. Invoke VBAT_LockRamLdoSettings(VBAT0) to lock LDO settings.

Bandgap Timer Control Interfaces

Functions in this group can be used to control internal software bandgap timers. Please note that bandgap timers are available when the bandgap is enabled and are clocked by the FRO16k.

Status, Interrupt, Wakeup Control Interfaces

VBAT_GetStatusFlags() and VBAT_ClearStatusFlags() function in this group can be used to get and clear status flags. VBAT_EnableInterrupts() and VBAT_DisableInterrupts() function in this group can be used to enable/disable interrupt. VBAT_EnableWakeup() and VBAT_DisableWakeup() function in this group can be used to enable/disable wakeup features.

Switch Control Interfaces

Functions in this group can be used to switch power supply of VBAT modules.

Data Structures

struct  vbat_fro16k_config_t
 The structure of internal 16kHz free running oscillator attributes. More...
 

Enumerations

enum  {
  kStatus_VBAT_Fro16kNotEnabled = MAKE_STATUS(kStatusGroup_VBAT, 0),
  kStatus_VBAT_BandgapNotEnabled = MAKE_STATUS(kStatusGroup_VBAT, 1),
  kStatus_VBAT_WrongCapacitanceValue = MAKE_STATUS(kStatusGroup_VBAT, 2),
  kStatus_VBAT_ClockMonitorLocked = MAKE_STATUS(kStatusGroup_VBAT, 3),
  kStatus_VBAT_OSC32KNotReady = MAKE_STATUS(kStatusGroup_VBAT, 4),
  kStatus_VBAT_LDONotReady = MAKE_STATUS(kStatusGroup_VBAT, 5),
  kStatus_VBAT_TamperLocked = MAKE_STATUS(kStatusGroup_VBAT, 6)
}
 The enumeration of VBAT module status. More...
 
enum  _vbat_clock_enable {
  kVBAT_EnableClockToDomain0 = 1U << 0U,
  kVBAT_EnableClockToDomain1 = 1U << 1U,
  kVBAT_EnableClockToDomain2 = 1U << 2U,
  kVBAT_EnableClockToDomain3 = 1U << 3U
}
 The enumeration of connections for OSC32K/FRO32K output clock to other modules. More...
 
enum  vbat_bandgap_refresh_period_t {
  kVBAT_BandgapRefresh7P8125ms = 0U,
  kVBAT_BandgapRefresh15P625ms = 1U,
  kVBAT_BandgapRefresh31P25ms = 2U,
  kVBAT_BandgapRefresh62P5ms = 3U
}
 The enumeration of bandgap refresh period. More...
 

Driver version

#define FSL_VBAT_DRIVER_VERSION   (MAKE_VERSION(2, 3, 1))
 VBAT driver version 2.3.1. More...
 

FRO16K Control Interfaces

void VBAT_ConfigFRO16k (VBAT_Type *base, const vbat_fro16k_config_t *config)
 Configure internal 16kHz free running oscillator, including enabel FRO16k, gate FRO16k output. More...
 
static void VBAT_EnableFRO16k (VBAT_Type *base, bool enable)
 Enable/disable internal 16kHz free running oscillator. More...
 
static bool VBAT_CheckFRO16kEnabled (VBAT_Type *base)
 Check if internal 16kHz free running oscillator is enabled. More...
 
static void VBAT_UngateFRO16k (VBAT_Type *base, uint8_t connectionsMask)
 Enable FRO16kHz output clock to selected modules. More...
 
static void VBAT_GateFRO16k (VBAT_Type *base, uint8_t connectionsMask)
 Disable FRO16kHz output clock to selected modules. More...
 
static void VBAT_LockFRO16kSettings (VBAT_Type *base)
 Lock settings of internal 16kHz free running oscillator, please note that if locked 16kHz FRO's settings can not be updated until the next POR. More...
 
static bool VBAT_CheckFRO16kSettingsLocked (VBAT_Type *base)
 Check if FRO16K settings are locked. More...
 

Data Structure Documentation

struct vbat_fro16k_config_t

Data Fields

bool enableFRO16k
 Enable/disable internal 16kHz free running oscillator. More...
 
uint8_t enabledConnectionsMask
 The mask of connected modules to enable FRO16k clock output. More...
 

Field Documentation

bool vbat_fro16k_config_t::enableFRO16k
uint8_t vbat_fro16k_config_t::enabledConnectionsMask

Macro Definition Documentation

#define FSL_VBAT_DRIVER_VERSION   (MAKE_VERSION(2, 3, 1))

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_VBAT_Fro16kNotEnabled 

Internal 16kHz free running oscillator not enabled.

kStatus_VBAT_BandgapNotEnabled 

Bandgap not enabled.

kStatus_VBAT_WrongCapacitanceValue 

Wrong capacitance for selected oscillator mode.

kStatus_VBAT_ClockMonitorLocked 

Clock monitor locked.

kStatus_VBAT_OSC32KNotReady 

OSC32K not ready.

kStatus_VBAT_LDONotReady 

LDO not ready.

kStatus_VBAT_TamperLocked 

Tamper locked.

Enumerator
kVBAT_EnableClockToDomain0 

Enable clock to power domain0.

kVBAT_EnableClockToDomain1 

Enable clock to power domain1.

kVBAT_EnableClockToDomain2 

Enable clock to power domain2.

kVBAT_EnableClockToDomain3 

Enable clock to power domain3.

Enumerator
kVBAT_BandgapRefresh7P8125ms 

Bandgap refresh every 7.8125ms.

kVBAT_BandgapRefresh15P625ms 

Bandgap refresh every 15.625ms.

kVBAT_BandgapRefresh31P25ms 

Bandgap refresh every 31.25ms.

kVBAT_BandgapRefresh62P5ms 

Bandgap refresh every 62.5ms.

Function Documentation

void VBAT_ConfigFRO16k ( VBAT_Type *  base,
const vbat_fro16k_config_t config 
)
Parameters
baseVBAT peripheral base address.
configPointer to vbat_fro16k_config_t structure.
static void VBAT_EnableFRO16k ( VBAT_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseVBAT peripheral base address.
enableUsed to enable/disable 16kHz FRO.
  • true Enable internal 16kHz free running oscillator.
  • false Disable internal 16kHz free running oscillator.
static bool VBAT_CheckFRO16kEnabled ( VBAT_Type *  base)
inlinestatic
Parameters
baseVBAT peripheral base address.
Return values
trueThe internal 16kHz Free running oscillator is enabled.
falseThe internal 16kHz Free running oscillator is enabled.
static void VBAT_UngateFRO16k ( VBAT_Type *  base,
uint8_t  connectionsMask 
)
inlinestatic
Parameters
baseVBAT peripheral base address.
connectionsMaskThe mask of modules that FRO16k is connected, should be the OR'ed value of vbat_clock_enable_t.
static void VBAT_GateFRO16k ( VBAT_Type *  base,
uint8_t  connectionsMask 
)
inlinestatic
Parameters
baseVBAT peripheral base address.
connectionsMaskThe OR'ed value of vbat_clock_enable_t.
static void VBAT_LockFRO16kSettings ( VBAT_Type *  base)
inlinestatic
Note
Please note that the operation to ungate/gate FRO 16kHz output clock can not be locked by this function.
Parameters
baseVBAT peripheral base address.
static bool VBAT_CheckFRO16kSettingsLocked ( VBAT_Type *  base)
inlinestatic
Parameters
baseVBAT peripheral base address.
Returns
true in case of FRO16k settings are locked, false in case of FRO16k settings are not locked.