cancel
Showing results for 
Search instead for 
Did you mean: 

SVS in ARM Micro-controllers

henriaghaei
Associate II
Posted on October 05, 2016 at 15:26

Unfortunately, I am sort of thinking of using SVS (Supply Voltage Supervisor) in my STM32f107kc. Why am I saying like this. Because, I am not entirely too sure my flash store my data without having power. Assuming it does not so, I am familiar with SVS in MSP micro-controllers. However, in STM32f107kc as I found out I have the following registers to control the power.

/******************************************************************************/

/*                                                                            */

/*                             Power Control                                  */

/*                                                                            */

/******************************************************************************/

/********************  Bit definition for PWR_CR register  ********************/

&sharpdefine  PWR_CR_LPDS                         ((uint16_t)0x0001)     /*!< Low-Power Deepsleep */

&sharpdefine  PWR_CR_PDDS                         ((uint16_t)0x0002)     /*!< Power Down Deepsleep */

&sharpdefine  PWR_CR_CWUF                         ((uint16_t)0x0004)     /*!< Clear Wakeup Flag */

&sharpdefine  PWR_CR_CSBF                         ((uint16_t)0x0008)     /*!< Clear Standby Flag */

&sharpdefine  PWR_CR_PVDE                         ((uint16_t)0x0010)     /*!< Power Voltage Detector Enable */

&sharpdefine  PWR_CR_PLS                          ((uint16_t)0x00E0)     /*!< PLS[2:0] bits (PVD Level Selection) */

&sharpdefine  PWR_CR_PLS_0                        ((uint16_t)0x0020)     /*!< Bit 0 */

&sharpdefine  PWR_CR_PLS_1                        ((uint16_t)0x0040)     /*!< Bit 1 */

&sharpdefine  PWR_CR_PLS_2                        ((uint16_t)0x0080)     /*!< Bit 2 */

/*!< PVD level configuration */

&sharpdefine  PWR_CR_PLS_2V2                      ((uint16_t)0x0000)     /*!< PVD level 2.2V */

&sharpdefine  PWR_CR_PLS_2V3                      ((uint16_t)0x0020)     /*!< PVD level 2.3V */

&sharpdefine  PWR_CR_PLS_2V4                      ((uint16_t)0x0040)     /*!< PVD level 2.4V */

&sharpdefine  PWR_CR_PLS_2V5                      ((uint16_t)0x0060)     /*!< PVD level 2.5V */

&sharpdefine  PWR_CR_PLS_2V6                      ((uint16_t)0x0080)     /*!< PVD level 2.6V */

&sharpdefine  PWR_CR_PLS_2V7                      ((uint16_t)0x00A0)     /*!< PVD level 2.7V */

&sharpdefine  PWR_CR_PLS_2V8                      ((uint16_t)0x00C0)     /*!< PVD level 2.8V */

&sharpdefine  PWR_CR_PLS_2V9                      ((uint16_t)0x00E0)     /*!< PVD level 2.9V */

&sharpdefine  PWR_CR_DBP                          ((uint16_t)0x0100)     /*!< Disable Backup Domain write protection */

/*******************  Bit definition for PWR_CSR register  ********************/

&sharpdefine  PWR_CSR_WUF                         ((uint16_t)0x0001)     /*!< Wakeup Flag */

&sharpdefine  PWR_CSR_SBF                         ((uint16_t)0x0002)     /*!< Standby Flag */

&sharpdefine  PWR_CSR_PVDO                        ((uint16_t)0x0004)     /*!< PVD Output */

&sharpdefine  PWR_CSR_EWUP                        ((uint16_t)0x0100)     /*!< Enable WKUP pin */

That I am not familiar with them entirely. On the other hand, in MSP I had to have the following code to enable SVS.

     if (SVSCTL&SVSFG){         // If the power goes off

  

     FlshCarma(  total_consumed_active_energy  );   // Store the lost number here

   

     SVSCTL |=  PORON; // enable POR    

            

      }

So, I am just wondering what are the major registers I am required to use to enable my SVS in ARM. Any working examples you may suggest?

Thanks!

#stm32f #svs
1 REPLY 1
Walid FTITI_O
Senior II
Posted on October 05, 2016 at 18:55

Hi CaEngineer, 

The device features an embedded programmable voltage detector (PVD) that monitors the

VDD/VDDA power supply and compares it to the VPVD threshold. An interrupt can be generated when VDD/VDDA drops below the VPVD threshold and/or when VDD/VDDA is higher than the VPVD threshold. The interrupt service routine can then generate a warning message and/or put the MCU into a safe state. The PVD is enabled by software.

I think you are using the 

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries/stsw-stm32054.html

 , you would check the PVD firmware example at this path: STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\PWR\PVD

-Hannibal-