LVD (Low-Voltage-Detect)

group group_lvd

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:

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).




Reason of Change


Added new device support.

Added new family of devices.


Fixed/documented MISRA 2012 violations.

MISRA 2012 compliance.


Updated the following functions for the PSoC 64 devices: Cy_LVD_Enable, Cy_LVD_Disable, Cy_LVD_SetThreshold, Cy_LVD_ClearInterrupt, Cy_LVD_SetInterrupt, Cy_LVD_SetInterruptMask, Cy_LVD_ClearInterruptMask, and Cy_LVD_SetInterruptConfig.

Added PSoC 64 device support.


Flattened the organization of the driver source code into the single source directory and the single include directory.

Driver library directory-structure simplification.

Added register access layer. Use register access macros instead of direct register access using dereferenced pointers.

Makes register access device-independent, so that the PDL does not need to be recompiled for each supported part number.


Added Low Power Callback section

Documentation update and clarification


Initial Version

API Reference