PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

API Reference
LVD (Low-Voltage-Detect)
PDL API Reference

## General Description

The LVD driver provides an API to manage the Low Voltage Detection block.

The functions and other declarations used in this driver are in cy_lvd.h. You can include cy_pdl.h to get access to all functions and declarations in the PDL.

The LVD block provides a status of currently observed VDDD voltage and triggers an interrupt when the observed voltage crosses an adjusted threshold.

# Configuration Considerations

To set up an LVD, configure the voltage threshold by the Cy_LVD_SetThreshold function, ensure that the LVD block itself and LVD interrupt are disabled (by the Cy_LVD_Disable and Cy_LVD_ClearInterruptMask functions correspondingly) before changing the threshold to prevent propagating a false interrupt. Then configure interrupts by the Cy_LVD_SetInterruptConfig function, do not forget to initialize an interrupt handler (the interrupt source number is srss_interrupt_IRQn). Then enable LVD by the Cy_LVD_Enable function, then wait for at least 20us to get the circuit stabilized and clear the possible false interrupts by the Cy_LVD_ClearInterrupt, and finally the LVD interrupt can be enabled by the Cy_LVD_SetInterruptMask function.

For example:

Cy_LVD_ClearInterruptMask();
Cy_LVD_SetThreshold(CY_LVD_THRESHOLD_3_15_V);
Cy_LVD_SetInterruptConfig(CY_LVD_INTR_BOTH);
Cy_LVD_Enable();
Cy_SysLib_DelayUs(20U);
Cy_LVD_ClearInterrupt();
Cy_LVD_SetInterruptMask();
CY_LVD_THRESHOLD_3_15_V
@ CY_LVD_THRESHOLD_3_15_V
Select LVD reference voltage: 3.15V.
Definition: cy_lvd.h:144
CY_LVD_INTR_BOTH
@ CY_LVD_INTR_BOTH
Select LVD interrupt: both edges.
Definition: cy_lvd.h:155
Cy_LVD_ClearInterruptMask
__STATIC_INLINE void Cy_LVD_ClearInterruptMask(void)
Disables LVD interrupts.
Definition: cy_lvd.h:387
Cy_LVD_SetThreshold
__STATIC_INLINE void Cy_LVD_SetThreshold(cy_en_lvd_tripsel_t threshold)
Sets a threshold for monitoring the VDDD voltage.
Definition: cy_lvd.h:279
Cy_LVD_SetInterruptMask
__STATIC_INLINE void Cy_LVD_SetInterruptMask(void)
Enables LVD interrupts.
Definition: cy_lvd.h:373
Cy_LVD_Enable
__STATIC_INLINE void Cy_LVD_Enable(void)
Enables the output of the LVD block when the VDDD voltage is at or below the threshold.
Definition: cy_lvd.h:246
Cy_LVD_ClearInterrupt
__STATIC_INLINE void Cy_LVD_ClearInterrupt(void)
Clears LVD interrupt.
Definition: cy_lvd.h:327
Cy_LVD_SetInterruptConfig
__STATIC_INLINE void Cy_LVD_SetInterruptConfig(cy_en_lvd_intr_config_t lvdInterruptConfig)
Sets a configuration for LVD interrupt.
Definition: cy_lvd.h:420
Cy_SysLib_DelayUs
void Cy_SysLib_DelayUs(uint16_t microseconds)
The function delays by the specified number of microseconds.
Definition: cy_syslib.c:119

Note that the LVD circuit is available only in Low Power and Ultra Low Power modes. If an LVD is required in Deep Sleep mode, then the device should be configured to periodically wake up from Deep Sleep using a Deep Sleep wakeup source. This makes sure a LVD check is performed during Low Power or Ultra Low Power modes.

# More Information

See the LVD chapter of the device technical reference manual (TRM).

## API Reference
| Macros
| Functions
| Enumerated Types