2014-07-03 01:52 AM
Scenario:
Our product displays the Last Reset Reason (from the RCC) when it powers up. This allows us to determine if the last reset was intentional or caused by e.g. a power brownout or software failure. Problem: When USE_FULL_ASSERT is defined, RCC_GetFlagStatus() uses the IS_RCC_FLAG macro to determine whether the passed value is a valid RCC flag. Attempting to check the state of theRCC_FLAG_OBLRST RCC flag causes an assertion failure. Cause: The IS_RCC_FLAG() macro (stm32lxx_rcc.h) is incorrectly defined. RCC_FLAG_WWDGRST is checked twice, andRCC_FLAG_OBLRST is not checked at all:
1.
#define IS_RCC_FLAG(FLAG) (((FLAG) == RCC_FLAG_HSIRDY) || ((FLAG) == RCC_FLAG_HSERDY) || \
2.
((FLAG) == RCC_FLAG_MSIRDY) || ((FLAG) == RCC_FLAG_PLLRDY) || \
3.
((FLAG) == RCC_FLAG_LSERDY) || ((FLAG) == RCC_FLAG_LSIRDY) || \
4.
((FLAG) == RCC_FLAG_PINRST) || ((FLAG) == RCC_FLAG_PORRST) || \
5.
((FLAG) == RCC_FLAG_SFTRST) || ((FLAG) == RCC_FLAG_IWDGRST)|| \
6.
((FLAG) == RCC_FLAG_WWDGRST)|| ((FLAG) == RCC_FLAG_LPWRRST)|| \
7.
((FLAG) == RCC_FLAG_WWDGRST)|| ((FLAG) == RCC_FLAG_LSECSS))
Fix:
The last line should be changed to:
1.
((FLAG) == RCC_FLAG_OBLRST) || ((FLAG) == RCC_FLAG_LSECSS))
This allows RCC_FLAG_OBLRST to be passsed as an RCC flag, and have its status checked without causing an assertion failure.
#rcc_flag_oblrst-stm32l1xx-bug
2014-07-03 03:58 AM
Hi Phil Pemberton,
This defect is fixed in STM32L1xx Standard Peripherals Library V1.3.0 available here http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF257913 Thanks for the report.With regards.