STM32 reset type judgment and software reset bug

Publisher:tony520Latest update time:2018-05-19 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

STM 32 has a serious BUG when resetting:

1. The power-on reset and the external watchdog chip reset cannot be distinguished! RCC_FLAG_BORRST, RCC_FLAG_PINRST, RCC_FLAG_LPWRRST are all reset!

2. In this way, when the key code is initialized during power-on reset, these codes do not need to be restarted when the watchdog is reset. This key code will cause abnormal application business! If the two interrupts are inseparable, the system abnormality will affect the business when the watchdog is reset!


/*
RCC_FLAG_BORRST: POR/PDR or BOR reset //Power-on/power-down reset (POR/PDR reset) or brownout (BOR) reset
RCC_FLAG_PINRST: Pin reset //NRST pin may be watchdog reset
RCC_FLAG_PORRST: POR/PDR reset
RCC_FLAG_SFTRST: Software reset
RCC_FLAG_IWDGRST: Independent Watchdog reset
RCC_FLAG_WWDGRST: Window Watchdog reset
RCC_FLAG_LPWRRST: Low Power reset
*/
/*********************************************************************************************
  Function Name: SysRstSrcRecordParameters
  : NoneReturn
  Value: System restart times recordDescription
  : Record the system restart methodAuthor
  : Li ShaoxiongVersion
  : V1.0 November 12, 2012
******************************************************************************/
u8 SysRstSrcRecord(u8 *pstRest)
{
    //u8 uchInfoChange=0;
    
    pstRest[0] = RCC_GetFlagStatus(RCC_FLAG_BORRST);
    pstRest[1] = RCC_GetFlagStatus(RCC_FLAG_PINRST);
    pstRest[ 2] = RCC_GetFlagStatus(RCC_FLAG_PORRST);
    pstRest[3] = RCC_GetFlagStatus(RCC_FLAG_SFTRST);   
    pstRest[4] = RCC_GetFlagStatus(RCC_FLAG_IWDGRST);
    pstRest[5] = RCC_GetFlagStatus(RCC_FLAG_WWDGRST);
    pstRest[6] = RCC_GetFlagStatus(RCC_FLAG_LPWRRST);

}


Keywords:STM32 Reference address:STM32 reset type judgment and software reset bug

Previous article:STM32 reset type judgment and software reset
Next article:STM32 protects the program by reading the unique ID number of the chip to prevent plagiarism

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号