Skip to content

Commit 238026d

Browse files
committed
Updated STM32F7xx HAL Drivers to v1.2.5
Included in STM32CubeF7 FW V1.11.0 Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent 2f0fa58 commit 238026d

File tree

8 files changed

+141
-61
lines changed

8 files changed

+141
-61
lines changed

system/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ typedef enum
7070
} HAL_LockTypeDef;
7171

7272
/* Exported macro ------------------------------------------------------------*/
73+
74+
#define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */
75+
7376
#define HAL_MAX_DELAY 0xFFFFFFFFU
7477

7578
#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
@@ -81,8 +84,6 @@ typedef enum
8184
(__DMA_HANDLE__).Parent = (__HANDLE__); \
8285
} while(0)
8386

84-
#define UNUSED(x) ((void)(x))
85-
8687
/** @brief Reset the Handle's State field.
8788
* @param __HANDLE__ specifies the Peripheral Handle.
8889
* @note This macro can be used for the following purpose:
@@ -153,8 +154,16 @@ typedef enum
153154
#endif /* __ALIGN_BEGIN */
154155
#endif /* __GNUC__ */
155156

157+
/* Macro to get variable aligned on 32-bytes,needed for cache maintenance purpose */
158+
#if defined (__GNUC__) /* GNU Compiler */
159+
#define ALIGN_32BYTES(buf) buf __attribute__ ((aligned (32)))
160+
#elif defined (__ICCARM__) /* IAR Compiler */
161+
#define ALIGN_32BYTES(buf) _Pragma("data_alignment=32") buf
162+
#elif defined (__CC_ARM) /* ARM Compiler */
163+
#define ALIGN_32BYTES(buf) __align(32) buf
164+
#endif
156165

157-
/**
166+
/**
158167
* @brief __RAM_FUNC definition
159168
*/
160169
#if defined ( __CC_ARM )

system/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_hcd.h

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
*
3333
******************************************************************************
34-
*/
34+
*/
3535

3636
/* Define to prevent recursive inclusion -------------------------------------*/
3737
#ifndef __STM32F7xx_HAL_HCD_H
@@ -43,25 +43,25 @@
4343

4444
/* Includes ------------------------------------------------------------------*/
4545
#include "stm32f7xx_ll_usb.h"
46-
46+
4747
/** @addtogroup STM32F7xx_HAL_Driver
4848
* @{
4949
*/
5050

5151
/** @defgroup HCD HCD
5252
* @brief HCD HAL module driver
5353
* @{
54-
*/
54+
*/
5555

5656
/* Exported types ------------------------------------------------------------*/
5757
/** @defgroup HCD_Exported_Types HCD Exported Types
5858
* @{
59-
*/
59+
*/
6060

61-
/** @defgroup HCD_Exported_Types_Group1 HCD State Structure definition
61+
/** @defgroup HCD_Exported_Types_Group1 HCD State Structure definition
6262
* @{
6363
*/
64-
typedef enum
64+
typedef enum
6565
{
6666
HAL_HCD_STATE_RESET = 0x00U,
6767
HAL_HCD_STATE_READY = 0x01U,
@@ -72,19 +72,19 @@ typedef enum
7272

7373
typedef USB_OTG_GlobalTypeDef HCD_TypeDef;
7474
typedef USB_OTG_CfgTypeDef HCD_InitTypeDef;
75-
typedef USB_OTG_HCTypeDef HCD_HCTypeDef ;
75+
typedef USB_OTG_HCTypeDef HCD_HCTypeDef ;
7676
typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef ;
7777
typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef ;
7878
/**
7979
* @}
8080
*/
8181

82-
/** @defgroup HCD_Exported_Types_Group2 HCD Handle Structure definition
82+
/** @defgroup HCD_Exported_Types_Group2 HCD Handle Structure definition
8383
* @{
84-
*/
84+
*/
8585
typedef struct
8686
{
87-
HCD_TypeDef *Instance; /*!< Register base address */
87+
HCD_TypeDef *Instance; /*!< Register base address */
8888
HCD_InitTypeDef Init; /*!< HCD required parameters */
8989
HCD_HCTypeDef hc[15]; /*!< Host channels parameters */
9090
HAL_LockTypeDef Lock; /*!< HCD peripheral status */
@@ -97,8 +97,8 @@ typedef struct
9797

9898
/**
9999
* @}
100-
*/
101-
100+
*/
101+
102102
/* Exported constants --------------------------------------------------------*/
103103
/** @defgroup HCD_Exported_Constants HCD Exported Constants
104104
* @{
@@ -108,12 +108,12 @@ typedef struct
108108
* @{
109109
*/
110110
#define HCD_SPEED_HIGH 0U
111-
#define HCD_SPEED_LOW 2U
111+
#define HCD_SPEED_LOW 2U
112112
#define HCD_SPEED_FULL 3U
113113
/**
114114
* @}
115115
*/
116-
116+
117117
/** @defgroup HCD_PHY_Module HCD PHY Module
118118
* @{
119119
*/
@@ -122,11 +122,11 @@ typedef struct
122122
/**
123123
* @}
124124
*/
125-
125+
126126
/**
127127
* @}
128-
*/
129-
128+
*/
129+
130130
/* Exported macro ------------------------------------------------------------*/
131131
/** @defgroup HCD_Exported_Macros HCD Exported Macros
132132
* @brief macros to handle interrupts and specific clock configurations
@@ -137,13 +137,13 @@ typedef struct
137137

138138
#define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__))
139139
#define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__))
140-
#define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U)
140+
#define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U)
141141

142-
#define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__))
143-
#define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM)
144-
#define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM)
145-
#define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM)
146-
#define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM)
142+
#define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__))
143+
#define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM)
144+
#define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM)
145+
#define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM)
146+
#define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM)
147147
/**
148148
* @}
149149
*/
@@ -158,7 +158,7 @@ typedef struct
158158
*/
159159
HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd);
160160
HAL_StatusTypeDef HAL_HCD_DeInit (HCD_HandleTypeDef *hhcd);
161-
HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd,
161+
HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd,
162162
uint8_t ch_num,
163163
uint8_t epnum,
164164
uint8_t dev_address,
@@ -178,21 +178,23 @@ void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd);
178178
* @{
179179
*/
180180
HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd,
181-
uint8_t pipe,
181+
uint8_t pipe,
182182
uint8_t direction ,
183-
uint8_t ep_type,
184-
uint8_t token,
185-
uint8_t* pbuff,
183+
uint8_t ep_type,
184+
uint8_t token,
185+
uint8_t* pbuff,
186186
uint16_t length,
187187
uint8_t do_ping);
188188

189189
/* Non-Blocking mode: Interrupt */
190-
void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd);
190+
void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd);
191191
void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd);
192192
void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd);
193193
void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd);
194-
void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd,
195-
uint8_t chnum,
194+
void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd);
195+
void HAL_HCD_PortDisabled_Callback(HCD_HandleTypeDef *hhcd);
196+
void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd,
197+
uint8_t chnum,
196198
HCD_URBStateTypeDef urb_state);
197199
/**
198200
* @}
@@ -268,7 +270,7 @@ uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd);
268270

269271
/**
270272
* @}
271-
*/
273+
*/
272274

273275
#ifdef __cplusplus
274276
}

system/Drivers/STM32F7xx_HAL_Driver/Release_Notes.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,11 @@ <h1 style="margin-bottom: 0.25in; text-align: center;" align="center"><span styl
680680
<tbody>
681681
<tr style="">
682682
<td style="padding: 0in;" valign="top">
683-
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 241px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.2.4 / 22-December-2017</span></h3>
683+
<h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 241px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.2.5 / 02-February-2018</span></h3>
684+
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
685+
Changes</span></u></b></p><ul style="margin-bottom: 0in; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; margin-top: 0cm;" type="square"><li class="MsoNormal" style="margin: 4.5pt 0in; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif; color: black;"><span style="font-family: Verdana,sans-serif; font-size: 10pt;">General updates to fix known defects and enhancements implementation</span></li><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;"><span style="font-weight: bold;">HAL&nbsp;</span>update</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">Add new macro to get variable aligned on 32-bytes, required for cache maintenance purpose</span></li><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">Update UNUSED() macro implementation to avoid GCC warning</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">The warning is detected when the UNUSED() macro is called from C++ file</span></li></ul></ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;"><span style="font-weight: bold;">HAL SAI </span>update</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">Update HAL_SAI_DMAStop() and HAL_SAI_Abort() process to fix the lock/unlock audio issue </span></li></ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;"><span style="font-weight: bold;">HAL PWR </span>update</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">Update
686+
HAL_PWR_EnterSLEEPMode() and HAL_PWR_EnterSTOPMode() APIs to ensure
687+
that all instructions finished before entering STOP mode. </span></li></ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;"><span style="font-weight: bold;">HAL HCD </span>update</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">Add new callback to be used to handle usb device connection/disconnection</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">HAL_HCD_PortEnabled_Callback()</span></li></ul><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">HAL_HCD_PortDisabled_Callback()</span></li></ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;">Update to prevent reactivate host interrrupt channel<br></span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 241px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.2.4 / 22-December-2017</span></h3>
684688
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
685689
Changes</span></u></b></p><ul style="margin-bottom: 0in; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; margin-top: 0cm;" type="square"><li class="MsoNormal" style="margin: 4.5pt 0in; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif; color: black;"><span style="font-family: Verdana,sans-serif; font-size: 10pt;">General updates to fix known defects and enhancements implementation</span></li><li class="MsoNormal" style="margin: 4.5pt 0in; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif; color: black;"><span style="font-family: Verdana,sans-serif; font-size: 10pt;"><span style="font-weight: bold;">The following changes done on the HAL drivers require an update on the application code based on older HAL versions</span></span></li><ul style="margin-bottom: 0in;"><li class="MsoNormal" style="margin: 4.5pt 0in; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif; color: black; font-weight: bold;"><span style="font-size: 10pt; font-family: Verdana;">Rework of HAL CAN driver (compatibility break)&nbsp;</span></li><ul style="margin-bottom: 0in;"><li class="MsoNormal" style="margin: 4.5pt 0in; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif; color: black;"><span style="font-size: 10pt; font-family: Verdana;">A
686690
new HAL CAN driver has been redesigned with new APIs, to bypass

system/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@
6666
* @{
6767
*/
6868
/**
69-
* @brief STM32F7xx HAL Driver version number V1.2.4
69+
* @brief STM32F7xx HAL Driver version number V1.2.5
7070
*/
7171
#define __STM32F7xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */
7272
#define __STM32F7xx_HAL_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
73-
#define __STM32F7xx_HAL_VERSION_SUB2 (0x04) /*!< [15:8] sub2 version */
73+
#define __STM32F7xx_HAL_VERSION_SUB2 (0x05) /*!< [15:8] sub2 version */
7474
#define __STM32F7xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */
7575
#define __STM32F7xx_HAL_VERSION ((__STM32F7xx_HAL_VERSION_MAIN << 24)\
7676
|(__STM32F7xx_HAL_VERSION_SUB1 << 16)\

system/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_hcd.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,34 @@ __weak void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd)
585585
*/
586586
}
587587

588+
/**
589+
* @brief Port Enabled Event callback.
590+
* @param hhcd: HCD handle
591+
* @retval None
592+
*/
593+
__weak void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd)
594+
{
595+
/* Prevent unused argument(s) compilation warning */
596+
UNUSED(hhcd);
597+
/* NOTE : This function Should not be modified, when the callback is needed,
598+
the HAL_HCD_Disconnect_Callback could be implemented in the user file
599+
*/
600+
}
601+
602+
/**
603+
* @brief Port Disabled Event callback.
604+
* @param hhcd: HCD handle
605+
* @retval None
606+
*/
607+
__weak void HAL_HCD_PortDisabled_Callback(HCD_HandleTypeDef *hhcd)
608+
{
609+
/* Prevent unused argument(s) compilation warning */
610+
UNUSED(hhcd);
611+
/* NOTE : This function Should not be modified, when the callback is needed,
612+
the HAL_HCD_Disconnect_Callback could be implemented in the user file
613+
*/
614+
}
615+
588616
/**
589617
* @brief Notify URB state change callback.
590618
* @param hhcd HCD handle
@@ -917,10 +945,8 @@ static void HCD_HC_IN_IRQHandler (HCD_HandleTypeDef *hhcd, uint8_t chnum)
917945
if(hhcd->hc[chnum].ep_type == EP_TYPE_INTR)
918946
{
919947
hhcd->hc[chnum].ErrCnt = 0;
920-
hhcd->hc[chnum].state = HC_NAK;
921948
__HAL_HCD_UNMASK_HALT_HC_INT(chnum);
922949
USB_HC_Halt(hhcd->Instance, chnum);
923-
924950
}
925951
else if ((hhcd->hc[chnum].ep_type == EP_TYPE_CTRL)||
926952
(hhcd->hc[chnum].ep_type == EP_TYPE_BULK))
@@ -1195,11 +1221,14 @@ static void HCD_Port_IRQHandler (HCD_HandleTypeDef *hhcd)
11951221
USBx_HOST->HFIR = (uint32_t)60000;
11961222
}
11971223
}
1224+
1225+
HAL_HCD_PortEnabled_Callback(hhcd);
11981226
HAL_HCD_Connect_Callback(hhcd);
11991227

12001228
}
12011229
else
12021230
{
1231+
HAL_HCD_PortDisabled_Callback(hhcd);
12031232
/* Cleanup HPRT */
12041233
USBx_HPRT0 &= ~(USB_OTG_HPRT_PENA | USB_OTG_HPRT_PCDET |\
12051234
USB_OTG_HPRT_PENCHNG | USB_OTG_HPRT_POCCHNG );

system/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry)
409409
/* Clear SLEEPDEEP bit of Cortex System Control Register */
410410
CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
411411

412+
/* Ensure that all instructions done before entering SLEEP mode */
413+
__DSB();
414+
__ISB();
415+
412416
/* Select SLEEP mode entry -------------------------------------------------*/
413417
if(SLEEPEntry == PWR_SLEEPENTRY_WFI)
414418
{
@@ -446,25 +450,29 @@ void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry)
446450
void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry)
447451
{
448452
uint32_t tmpreg = 0;
449-
453+
450454
/* Check the parameters */
451455
assert_param(IS_PWR_REGULATOR(Regulator));
452456
assert_param(IS_PWR_STOP_ENTRY(STOPEntry));
453-
457+
454458
/* Select the regulator state in Stop mode ---------------------------------*/
455459
tmpreg = PWR->CR1;
456460
/* Clear PDDS and LPDS bits */
457461
tmpreg &= (uint32_t)~(PWR_CR1_PDDS | PWR_CR1_LPDS);
458-
462+
459463
/* Set LPDS, MRLVDS and LPLVDS bits according to Regulator value */
460464
tmpreg |= Regulator;
461-
465+
462466
/* Store the new value */
463467
PWR->CR1 = tmpreg;
464-
468+
465469
/* Set SLEEPDEEP bit of Cortex System Control Register */
466470
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
467-
471+
472+
/* Ensure that all instructions done before entering STOP mode */
473+
__DSB();
474+
__ISB();
475+
468476
/* Select Stop mode entry --------------------------------------------------*/
469477
if(STOPEntry == PWR_STOPENTRY_WFI)
470478
{

0 commit comments

Comments
 (0)