The MCUXpresso SDK provides a peripheral driver for the Smart Power Switch (VBAT) block of MCUXpresso SDK devices.
Based on VBAT's features the VBAT driver are divided into 4 function groups.
FRO16K Control Interfaces
Functions in this group can be used to configure internal 16kHz free running oscillator.
RAM_LDO Control Interfaces
Functions in this group can be used to control internal bandgap and RAM_LDO.
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.
|
enum | {
kStatus_VBAT_Fro16kNotEnabled,
kStatus_VBAT_BandgapNotEnabled = MAKE_STATUS(kStatusGroup_VBAT, 1)
} |
| The enumeration of VBAT module status. More...
|
|
enum | _vbat_status_flag {
kVBAT_StatusFlagPORDetect = VBAT_STATUSA_POR_DET_MASK,
kVBAT_StatusFlagWakeupPin = VBAT_STATUSA_WAKEUP_FLAG_MASK,
kVBAT_StatusFlagBandgapTimer0 = VBAT_STATUSA_TIMER0_FLAG_MASK,
kVBAT_StatusFlagBandgapTimer1 = VBAT_STATUSA_TIMER1_FLAG_MASK,
kVBAT_StatusFlagLdoReady = VBAT_STATUSA_LDO_RDY_MASK
} |
| The enumeration of VBAT status flags. More...
|
|
enum | _vbat_interrupt_enable {
kVBAT_InterruptEnablePORDetect = VBAT_IRQENA_POR_DET_MASK,
kVBAT_InterruptEnableWakeupPin = VBAT_IRQENA_WAKEUP_FLAG_MASK,
kVBAT_InterruptEnableBandgapTimer0 = VBAT_IRQENA_TIMER0_FLAG_MASK,
kVBAT_InterruptEnableBandgapTimer1 = VBAT_IRQENA_TIMER1_FLAG_MASK,
kVBAT_InterruptEnableLdoReady = VBAT_IRQENA_LDO_RDY_MASK,
kVBAT_AllInterruptsEnable
} |
| The enumeration of VBAT interrupt enable. More...
|
|
enum | _vbat_wakeup_enable {
kVBAT_WakeupEnablePORDetect = VBAT_WAKENA_POR_DET_MASK,
kVBAT_WakeupEnableWakeupPin = VBAT_WAKENA_WAKEUP_FLAG_MASK,
kVBAT_WakeupEnableBandgapTimer0 = VBAT_WAKENA_TIMER0_FLAG_MASK,
kVBAT_WakeupEnableBandgapTimer1 = VBAT_WAKENA_TIMER1_FLAG_MASK,
kVBAT_WakeupEnableLdoReady = VBAT_WAKENA_LDO_RDY_MASK,
kVBAT_AllWakeupsEnable
} |
| The enumeration of VBAT wakeup enable. More...
|
|
enum | _vbat_bandgap_timer_id {
kVBAT_BandgapTimer0 = 1U << 0U,
kVBAT_BandgapTimer1 = 1U << 1U
} |
| The enumeration of bandgap timer id, VBAT support two bandgap timers. 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...
|
|
enum | vbat_bandgap_timer_timeout_period_t {
kVBAT_BangapTimerTimeout1s = 0U,
kVBAT_BangapTimerTimeout500ms = 1U,
kVBAT_BangapTimerTimeout250ms = 2U,
kVBAT_BangapTimerTimeout125ms = 3U,
kVBAT_BangapTimerTimeout62P5ms = 4U,
kVBAT_BangapTimerTimeout31P25ms = 5U
} |
| The enumeration of bandgap timer timeout period. More...
|
|
|
static uint32_t | VBAT_GetStatusFlags (VBAT_Type *base) |
| Get VBAT status flags. More...
|
|
static void | VBAT_ClearStatusFlags (VBAT_Type *base, uint32_t mask) |
| Clear VBAT status flags. More...
|
|
static void | VBAT_EnableInterrupts (VBAT_Type *base, uint32_t mask) |
| Enable interrupts for the VBAT module, such as POR detect interrupt, Wakeup Pin interrupt and so on. More...
|
|
static void | VBAT_DisableInterrupts (VBAT_Type *base, uint32_t mask) |
| Disable interrupts for the VBAT module, such as POR detect interrupt, wakeup pin interrupt and so on. More...
|
|
static void | VBAT_EnableWakeup (VBAT_Type *base, uint32_t mask) |
| Enable wakeup for the VBAT module, such as POR detect wakeup, wakeup pin wakeup and so on. More...
|
|
static void | VBAT_DisableWakeup (VBAT_Type *base, uint32_t mask) |
| Disable wakeup for VBAT module, such as POR detect wakeup, wakeup pin wakeup and so on. More...
|
|
static void | VBAT_LockInterruptWakeupSettings (VBAT_Type *base) |
| Lock VBAT interrupt and wakeup settings, please note that if locked the interrupt and wakeup settings can not be updated until the next POR. More...
|
|
struct vbat_fro16k_config_t |
bool vbat_fro16k_config_t::enableFRO16k |
bool vbat_fro16k_config_t::enableFRO16kOutput |
Enumerator |
---|
kStatus_VBAT_Fro16kNotEnabled |
Internal 16kHz free running oscillator not enabled.
|
kStatus_VBAT_BandgapNotEnabled |
Bandgap not enabled.
|
Enumerator |
---|
kVBAT_StatusFlagPORDetect |
VBAT domain has been reset.
|
kVBAT_StatusFlagWakeupPin |
A falling edge is detected on the wakeup pin.
|
kVBAT_StatusFlagBandgapTimer0 |
Bandgap Timer0 period reached.
|
kVBAT_StatusFlagBandgapTimer1 |
Bandgap Timer1 period reached.
|
kVBAT_StatusFlagLdoReady |
LDO is enabled and ready.
|
Enumerator |
---|
kVBAT_InterruptEnablePORDetect |
Enable POR detect interrupt.
|
kVBAT_InterruptEnableWakeupPin |
Enable the interrupt when a falling edge is detected on the wakeup pin.
|
kVBAT_InterruptEnableBandgapTimer0 |
Enable the interrupt if Bandgap Timer0 period reached.
|
kVBAT_InterruptEnableBandgapTimer1 |
Enable the interrupt if Bandgap Timer1 period reached.
|
kVBAT_InterruptEnableLdoReady |
Enable LDO ready interrupt.
|
kVBAT_AllInterruptsEnable |
Enable all interrupts.
|
Enumerator |
---|
kVBAT_WakeupEnablePORDetect |
Enable POR detect wakeup.
|
kVBAT_WakeupEnableWakeupPin |
Enable wakeup feature when a falling edge is detected on the wakeup pin.
|
kVBAT_WakeupEnableBandgapTimer0 |
Enable wakeup feature when bandgap timer0 period reached.
|
kVBAT_WakeupEnableBandgapTimer1 |
Enable wakeup feature when bandgap timer1 period reached.
|
kVBAT_WakeupEnableLdoReady |
Enable wakeup when LDO ready.
|
kVBAT_AllWakeupsEnable |
Enable all wakeup.
|
Enumerator |
---|
kVBAT_BandgapTimer0 |
Bandgap Timer0.
|
kVBAT_BandgapTimer1 |
Bandgap Timer1.
|
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.
|
Enumerator |
---|
kVBAT_BangapTimerTimeout1s |
Bandgap timer timerout every 1s.
|
kVBAT_BangapTimerTimeout500ms |
Bandgap timer timerout every 500ms.
|
kVBAT_BangapTimerTimeout250ms |
Bandgap timer timerout every 250ms.
|
kVBAT_BangapTimerTimeout125ms |
Bandgap timer timerout every 125ms.
|
kVBAT_BangapTimerTimeout62P5ms |
Bandgap timer timerout every 62.5ms.
|
kVBAT_BangapTimerTimeout31P25ms |
Bandgap timer timerout every 31.25ms.
|
static void VBAT_EnableFRO16k |
( |
VBAT_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
enable | Used 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
-
base | VBAT peripheral base address. |
- Return values
-
true | The internal 16kHz Free running oscillator is enabled. |
false | The internal 16kHz Free running oscillator is enabled. |
static void VBAT_UngateFRO16k |
( |
VBAT_Type * |
base, |
|
|
bool |
unGateFRO16k |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
unGateFRO16k | Used to gate/ungate FRO 16kHz output.
- true FRO 16kHz output clock to other modules is enabled.
- false FRO 16kHz output clock to other modules is disabled.
|
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
-
base | VBAT peripheral base address. |
status_t VBAT_EnableBandgap |
( |
VBAT_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
- Note
- The FRO16K must be enabled before enabling the bandgap.
-
This setting can be locked by VBAT_LockLdoRamSettings() function.
- Parameters
-
base | VBAT peripheral base address. |
enable | Used to enable/disable bandgap.
- true Enable the bandgap.
- false Disable the bandgap.
|
- Return values
-
kStatus_Success | Success to enable/disable the bandgap. |
kStatus_VBAT_Fro16kNotEnabled | Fail to enable the bandgap due to FRO16k is not enabled previously. |
static bool VBAT_CheckBandgapEnabled |
( |
VBAT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
- Return values
-
true | The bandgap is enabled. |
false | The bandgap is disabled. |
static void VBAT_EnableBandgapRefreshMode |
( |
VBAT_Type * |
base, |
|
|
bool |
enableRefreshMode |
|
) |
| |
|
inlinestatic |
- Note
- This setting can be locked by VBAT_LockLdoRamSettings() function.
- Parameters
-
base | VBAT peripheral base address. |
enableRefreshMode | Used to enable/disable bandgap low power refresh mode.
- true Enable bandgap low power refresh mode.
- false Disable bandgap low power refresh mode.
|
status_t VBAT_EnableBackupSRAMRegulator |
( |
VBAT_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
- Note
- This setting can be locked by VBAT_LockLdoRamSettings() function.
- Parameters
-
base | VBAT peripheral base address. |
enable | Used to enable/disable RAM_LDO.
- true Enable backup SRAM regulator.
- false Disable backup SRAM regulator.
|
- Return values
-
kStatusSuccess | Success to enable/disable backup SRAM regulator. |
kStatus_VBAT_Fro16kNotEnabled | Fail to enable backup SRAM regulator due to FRO16k is not enabled previously. |
kStatus_VBAT_BandgapNotEnabled | Fail to enable backup SRAM regulator due to the bandgap is not enabled previously. |
static void VBAT_LockLdoRamSettings |
( |
VBAT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
status_t VBAT_SwitchSRAMPowerByVBAT |
( |
VBAT_Type * |
base | ) |
|
- Note
- This function can be used to switch the SRAM to the VBAT retention supply at any time, but please note that the SRAM must not be accessed during this time and software must manually invoke VBAT_SwitchSRAMPowerBySocSupply() before accessing the SRAM again.
- Parameters
-
base | VBAT peripheral base address. |
- Return values
-
kStatusSuccess | Success to Switch SRAM powered by VBAT. |
kStatus_VBAT_Fro16kNotEnabled | Fail to switch SRAM powered by VBAT due to FRO16K not enabled previously. |
static void VBAT_SwitchSRAMPowerBySocSupply |
( |
VBAT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
static void VBAT_EnableSRAMArrayRetained |
( |
VBAT_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
enable | Used to enable/disable SRAM array power retained.
- true SRAM array is retained when powered from VDD_CORE.
- false SRAM array is not retained when powered from VDD_CORE.
|
static void VBAT_EnableSRAMIsolation |
( |
VBAT_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
enable | Used to enable/disable SRAM violation.
- true SRAM will be isolated.
- false SRAM state follows the SoC power modes.
|
status_t VBAT_EnableBandgapTimer |
( |
VBAT_Type * |
base, |
|
|
bool |
enable, |
|
|
uint8_t |
timerIdMask |
|
) |
| |
- Note
- The bandgap timer is available when the bandgap is enabled and are clocked by the FRO16k.
- Parameters
-
base | VBAT peripheral base address. |
enable | Used to enable/disable bandgap timer. |
timerIdMask | The mask of bandgap timer Id, should be the OR'ed value of vbat_bandgap_timer_id_t. |
- Return values
-
kStatus_Success | Success to enable/disable selected bandgap timer. |
kStatus_VBAT_Fro16kNotEnabled | Fail to enable/disable selected bandgap timer due to FRO16k not enabled previously. |
kStatus_VBAT_BandgapNotEnabled | Fail to enable/disable selected bandgap timer due to bandgap not enabled previously. |
static uint32_t VBAT_GetStatusFlags |
( |
VBAT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
- Returns
- The asserted status flags, should be the OR'ed value of vbat_status_flag_t.
static void VBAT_ClearStatusFlags |
( |
VBAT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
static void VBAT_EnableInterrupts |
( |
VBAT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
mask | The mask of interrupts to be enabled, should be the OR'ed value of vbat_interrupt_enable_t. |
static void VBAT_DisableInterrupts |
( |
VBAT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |
mask | The mask of interrupts to be disabled, should be the OR'ed value of vbat_interrupt_enable_t. |
static void VBAT_EnableWakeup |
( |
VBAT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
static void VBAT_DisableWakeup |
( |
VBAT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
static void VBAT_LockInterruptWakeupSettings |
( |
VBAT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | VBAT peripheral base address. |