diff options
author | rihab kouki <rihab.kouki@st.com> | 2021-07-23 12:14:42 +0300 |
---|---|---|
committer | rihab kouki <rihab.kouki@st.com> | 2021-07-23 16:12:38 +0300 |
commit | 95f19205e36f1e26409b88e302537cbc8918f7e9 (patch) | |
tree | 300d4ed71cc66e1e68c12ebc51aedb5d5136b6c8 /Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router | |
parent | 2d1f0ea0748169a268228d0f7b6416e5127e6027 (diff) |
Release v1.12.0
Diffstat (limited to 'Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router')
6 files changed, 142 insertions, 78 deletions
diff --git a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Inc/stm32_lpm_if.h b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Inc/stm32_lpm_if.h index 3e0b3c535..d8e67947f 100644 --- a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Inc/stm32_lpm_if.h +++ b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Inc/stm32_lpm_if.h @@ -6,13 +6,13 @@ ****************************************************************************** * @attention * - * <h2><center>© Copyright (c) 2020 STMicroelectronics. +* <h2><center>© Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * - * This software component is licensed by ST under BSD 3-Clause license, - * the "License"; You may not use this file except in compliance with the - * License. You may obtain a copy of the License at: - * opensource.org/licenses/BSD-3-Clause +* This software component is licensed by ST under BSD 3-Clause license, +* the "License"; You may not use this file except in compliance with the +* License. You may obtain a copy of the License at: +* opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ diff --git a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Src/stm32_lpm_if.c b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Src/stm32_lpm_if.c index 01d478092..fba978d88 100644 --- a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Src/stm32_lpm_if.c +++ b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/Core/Src/stm32_lpm_if.c @@ -6,7 +6,7 @@ *************************************************************************************** * @attention * - * <h2><center>© Copyright (c) 2020 STMicroelectronics. + * <h2><center>© Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, @@ -17,8 +17,8 @@ ****************************************************************************** */ /* USER CODE END Header */ - -/* Includes ------------------------------------------------------------------*/ + +/* Includes ------------------------------------------------------------------*/ #include "stm32_lpm_if.h" #include "stm32_lpm.h" #include "app_conf.h" @@ -27,20 +27,22 @@ /* USER CODE END include */ /* Exported variables --------------------------------------------------------*/ -const struct UTIL_LPM_Driver_s UTIL_PowerDriver = +const struct UTIL_LPM_Driver_s UTIL_PowerDriver = { PWR_EnterSleepMode, PWR_ExitSleepMode, - + PWR_EnterStopMode, - PWR_ExitStopMode, - + PWR_ExitStopMode, + PWR_EnterOffMode, PWR_ExitOffMode, }; /* Private function prototypes -----------------------------------------------*/ static void Switch_On_HSI( void ); +static void EnterLowPower( void ); +static void ExitLowPower( void ); /* USER CODE BEGIN Private_Function_Prototypes */ /* USER CODE END Private_Function_Prototypes */ @@ -69,14 +71,17 @@ static void Switch_On_HSI( void ); */ void PWR_EnterOffMode( void ) { -/* USER CODE BEGIN PWR_EnterOffMode */ +/* USER CODE BEGIN PWR_EnterOffMode_1 */ +/* USER CODE END PWR_EnterOffMode_1 */ /** * The systick should be disabled for the same reason than when the device enters stop mode because * at this time, the device may enter either OffMode or StopMode. */ HAL_SuspendTick(); + EnterLowPower(); + /************************************************************************************ * ENTER OFF MODE ***********************************************************************************/ @@ -100,8 +105,12 @@ void PWR_EnterOffMode( void ) __force_stores( ); #endif - __WFI( ); -/* USER CODE END PWR_EnterOffMode */ + __WFI(); + +/* USER CODE BEGIN PWR_EnterOffMode_2 */ + +/* USER CODE END PWR_EnterOffMode_2 */ + return; } /** @@ -111,11 +120,14 @@ void PWR_EnterOffMode( void ) */ void PWR_ExitOffMode( void ) { -/* USER CODE BEGIN PWR_ExitOffMode */ +/* USER CODE BEGIN PWR_ExitOffMode_1 */ +/* USER CODE END PWR_ExitOffMode_1 */ HAL_ResumeTick(); +/* USER CODE BEGIN PWR_ExitOffMode_2 */ -/* USER CODE END PWR_ExitOffMode */ +/* USER CODE END PWR_ExitOffMode_2 */ + return; } /** @@ -126,7 +138,9 @@ void PWR_ExitOffMode( void ) */ void PWR_EnterStopMode( void ) { -/* USER CODE BEGIN PWR_EnterStopMode */ +/* USER CODE BEGIN PWR_EnterStopMode_1 */ + +/* USER CODE END PWR_EnterStopMode_1 */ /** * When HAL_DBGMCU_EnableDBGStopMode() is called to keep the debugger active in Stop Mode, * the systick shall be disabled otherwise the cpu may crash when moving out from stop mode @@ -140,31 +154,7 @@ void PWR_EnterStopMode( void ) /** * This function is called from CRITICAL SECTION */ - while( LL_HSEM_1StepLock( HSEM, CFG_HW_RCC_SEMID ) ); - - if ( ! LL_HSEM_1StepLock( HSEM, CFG_HW_ENTRY_STOP_MODE_SEMID ) ) - { - if( LL_PWR_IsActiveFlag_C2DS( ) ) - { - /* Release ENTRY_STOP_MODE semaphore */ - LL_HSEM_ReleaseLock( HSEM, CFG_HW_ENTRY_STOP_MODE_SEMID, 0 ); - - /** - * The switch on HSI before entering Stop Mode is required - */ - Switch_On_HSI( ); - } - } - else - { - /** - * The switch on HSI before entering Stop Mode is required - */ - Switch_On_HSI( ); - } - - /* Release RCC semaphore */ - LL_HSEM_ReleaseLock( HSEM, CFG_HW_RCC_SEMID, 0 ); + EnterLowPower(); /************************************************************************************ * ENTER STOP MODE @@ -181,7 +171,11 @@ void PWR_EnterStopMode( void ) #endif __WFI(); -/* USER CODE END PWR_EnterStopMode */ + +/* USER CODE BEGIN PWR_EnterStopMode_2 */ + +/* USER CODE END PWR_EnterStopMode_2 */ + return; } /** @@ -192,37 +186,19 @@ void PWR_EnterStopMode( void ) */ void PWR_ExitStopMode( void ) { -/* USER CODE BEGIN PWR_ExitStopMode */ +/* USER CODE BEGIN PWR_ExitStopMode_1 */ + +/* USER CODE END PWR_ExitStopMode_1 */ /** * This function is called from CRITICAL SECTION */ - - /* Release ENTRY_STOP_MODE semaphore */ - LL_HSEM_ReleaseLock( HSEM, CFG_HW_ENTRY_STOP_MODE_SEMID, 0 ); - - while( LL_HSEM_1StepLock( HSEM, CFG_HW_RCC_SEMID ) ); - - if(LL_RCC_GetSysClkSource( ) == LL_RCC_SYS_CLKSOURCE_STATUS_HSI) - { - LL_RCC_HSE_Enable( ); - while(!LL_RCC_HSE_IsReady( )); - LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); - while (LL_RCC_GetSysClkSource( ) != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); - } - else - { - /** - * As long as the current application is fine with HSE as system clock source, - * there is nothing to do here - */ - } - - /* Release RCC semaphore */ - LL_HSEM_ReleaseLock( HSEM, CFG_HW_RCC_SEMID, 0 ); + ExitLowPower(); HAL_ResumeTick(); +/* USER CODE BEGIN PWR_ExitStopMode_2 */ -/* USER CODE END PWR_ExitStopMode */ +/* USER CODE END PWR_ExitStopMode_2 */ + return; } /** @@ -233,7 +209,9 @@ void PWR_ExitStopMode( void ) */ void PWR_EnterSleepMode( void ) { -/* USER CODE BEGIN PWR_EnterSleepMode */ +/* USER CODE BEGIN PWR_EnterSleepMode_1 */ + +/* USER CODE END PWR_EnterSleepMode_1 */ HAL_SuspendTick(); @@ -250,7 +228,10 @@ void PWR_EnterSleepMode( void ) #endif __WFI( ); -/* USER CODE END PWR_EnterSleepMode */ +/* USER CODE BEGIN PWR_EnterSleepMode_2 */ + +/* USER CODE END PWR_EnterSleepMode_2 */ + return; } /** @@ -261,11 +242,14 @@ void PWR_EnterSleepMode( void ) */ void PWR_ExitSleepMode( void ) { -/* USER CODE BEGIN PWR_ExitSleepMode */ +/* USER CODE BEGIN PWR_ExitSleepMode_1 */ +/* USER CODE END PWR_ExitSleepMode_1 */ HAL_ResumeTick(); +/* USER CODE BEGIN PWR_ExitSleepMode_2 */ -/* USER CODE END PWR_ExitSleepMode */ +/* USER CODE END PWR_ExitSleepMode_2 */ + return; } /************************************************************* @@ -274,6 +258,85 @@ void PWR_ExitSleepMode( void ) * *************************************************************/ /** + * @brief Setup the system to enter either stop or off mode + * @param none + * @retval none + */ +static void EnterLowPower( void ) +{ + /** + * This function is called from CRITICAL SECTION + */ + + while( LL_HSEM_1StepLock( HSEM, CFG_HW_RCC_SEMID ) ); + + if ( ! LL_HSEM_1StepLock( HSEM, CFG_HW_ENTRY_STOP_MODE_SEMID ) ) + { + if( LL_PWR_IsActiveFlag_C2DS() || LL_PWR_IsActiveFlag_C2SB() ) + { + /* Release ENTRY_STOP_MODE semaphore */ + LL_HSEM_ReleaseLock( HSEM, CFG_HW_ENTRY_STOP_MODE_SEMID, 0 ); + + /** + * The switch on HSI before entering Stop Mode is required on Cut2.0 + * It is useless from Cut2.1 + */ + Switch_On_HSI( ); + } + } + else + { + /** + * The switch on HSI before entering Stop Mode is required on Cut2.0 + * It is useless from Cut2.1 + */ + Switch_On_HSI( ); + } + + /* Release RCC semaphore */ + LL_HSEM_ReleaseLock( HSEM, CFG_HW_RCC_SEMID, 0 ); + + return; +} + +/** + * @brief Restore the system to exit stop mode + * @param none + * @retval none + */ +static void ExitLowPower( void ) +{ + /* Release ENTRY_STOP_MODE semaphore */ + LL_HSEM_ReleaseLock( HSEM, CFG_HW_ENTRY_STOP_MODE_SEMID, 0 ); + + while( LL_HSEM_1StepLock( HSEM, CFG_HW_RCC_SEMID ) ); + + if(LL_RCC_GetSysClkSource( ) == LL_RCC_SYS_CLKSOURCE_STATUS_HSI) + { +/* Restore the clock configuration of the application in this user section */ +/* USER CODE BEGIN ExitLowPower_1 */ + LL_RCC_HSE_Enable( ); + __HAL_FLASH_SET_LATENCY(FLASH_LATENCY_1); + while(!LL_RCC_HSE_IsReady( )); + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE); + while (LL_RCC_GetSysClkSource( ) != LL_RCC_SYS_CLKSOURCE_STATUS_HSE); +/* USER CODE END ExitLowPower_1 */ + } + else + { +/* If the application is not running on HSE restore the clock configuration in this user section */ +/* USER CODE BEGIN ExitLowPower_2 */ + +/* USER CODE END ExitLowPower_2 */ + } + + /* Release RCC semaphore */ + LL_HSEM_ReleaseLock( HSEM, CFG_HW_RCC_SEMID, 0 ); + + return; +} + +/** * @brief Switch the system clock on HSI * @param none * @retval none @@ -285,6 +348,7 @@ static void Switch_On_HSI( void ) LL_RCC_SetSysClkSource( LL_RCC_SYS_CLKSOURCE_HSI ); LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSI); while (LL_RCC_GetSysClkSource( ) != LL_RCC_SYS_CLKSOURCE_STATUS_HSI); + return; } /* USER CODE BEGIN Private_Functions */ diff --git a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/Zigbee_OnOff_Client_Router.ewp b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/Zigbee_OnOff_Client_Router.ewp index 5838ec5d4..ad5dd91bb 100644 --- a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/Zigbee_OnOff_Client_Router.ewp +++ b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/Zigbee_OnOff_Client_Router.ewp @@ -316,7 +316,7 @@ </option> <option> <name>CCRequirePrototypes</name> - <state>0</state> + <state>1</state> </option> <option> <name>CCDiagWarnAreErr</name> @@ -359,7 +359,7 @@ <state>$PROJ_DIR$/../../../../../../Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci</state> <state>$PROJ_DIR$/../../../../../../Middlewares/ST/STM32_WPAN/utilities</state> <state>$PROJ_DIR$/../../../../../../Drivers/CMSIS/Device/ST/STM32WBxx/Include</state> - <state>$PROJ_DIR$/../../../../../../Middlewares/ST/STM32_WPAN/zigbee/core/Inc</state> + <state>$PROJ_DIR$/../../../../../../Middlewares/ST/STM32_WPAN/zigbee/core/inc</state> <state>$PROJ_DIR$/../../../../../../Middlewares/ST/STM32_WPAN/zigbee/stack</state> <state>$PROJ_DIR$/../../../../../../Middlewares/ST/STM32_WPAN/zigbee/stack/include</state> <state>$PROJ_DIR$/../../../../../../Middlewares/ST/STM32_WPAN/zigbee/stack/include/mac</state> diff --git a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/stm32wb55xx_flash_cm4.icf b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/stm32wb55xx_flash_cm4.icf index 70aec4026..b50e32be9 100644 --- a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/stm32wb55xx_flash_cm4.icf +++ b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/EWARM/stm32wb55xx_flash_cm4.icf @@ -7,7 +7,7 @@ define symbol __ICFEDIT_intvec_start__ = 0x08000000; /***** FLASH Part dedicated to M4 *****/ define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; -define symbol __ICFEDIT_region_RAM_start__ = 0x20000004; +define symbol __ICFEDIT_region_RAM_start__ = 0x20000008; define symbol __ICFEDIT_region_RAM_end__ = 0x2002F000; /*0x2002FFFF---------------------------------------| diff --git a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/MDK-ARM/stm32wb55xx_flash_cm4.sct b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/MDK-ARM/stm32wb55xx_flash_cm4.sct index 63845c07b..9d4d446ba 100644 --- a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/MDK-ARM/stm32wb55xx_flash_cm4.sct +++ b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/MDK-ARM/stm32wb55xx_flash_cm4.sct @@ -8,7 +8,7 @@ LR_IROM1 0x08000000 0x00080000 { ; load region size_region *(InRoot$$Sections) .ANY (+RO) } - RW_IRAM1 0x20000004 0x2FFFC { ; RW data + RW_IRAM1 0x20000008 0x2FFF8 { ; RW data .ANY (+RW +ZI) } RW_RAM_SHARED 0x20030000 0x2800 { ; RW data diff --git a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/STM32CubeIDE/STM32WB55RGVX_FLASH.ld b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/STM32CubeIDE/STM32WB55RGVX_FLASH.ld index 2267d7c48..cdb1e6174 100644 --- a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/STM32CubeIDE/STM32WB55RGVX_FLASH.ld +++ b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Zigbee/Zigbee_OnOff_Client_Router/STM32CubeIDE/STM32WB55RGVX_FLASH.ld @@ -56,7 +56,7 @@ _Min_Stack_Size = 0x1000 ; /* required amount of stack */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K -RAM1 (xrw) : ORIGIN = 0x20000004, LENGTH = 0x2FFFC +RAM1 (xrw) : ORIGIN = 0x20000008, LENGTH = 0x2FFF8 RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K } |