cancel
Showing results for 
Search instead for 
Did you mean: 

MCU not entering into HAL_PWREx_EnterSHUTDOWNMode - black project

Balza84
Visitor

Hello everyone!

Hardware MCU is STM32WB5MMGH

I'm trying to set the MCU in shutdown mode in a complex project, but failing. And with "failing" i mean the code still execute even after the shutdown command run. So the MCU it's not entering shutdown mode.

I've translated the single feature to a new blank project, with just the necessary code for the shutdown feature. And this is the int main :

 

 

int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* Configure the peripherals common clocks */
  PeriphCommonClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_RTC_Init();
  /* USER CODE BEGIN 2 */
  HAL_PWREx_ClearWakeupFlag(PWR_FLAG_WUF1);
  HAL_PWREx_EnterSHUTDOWNMode();
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
	HAL_Delay(250);
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

 

 

No radios (Core2), nor IWDG at all.

The HAL_PWREx_EnterSHUTDOWNMode also suggest that something is not working, because after the command call, it goes istantly on the CLEAR_BIT line.

 

void HAL_PWREx_EnterSHUTDOWNMode(void)
{
  /* Set Shutdown mode */
  MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, PWR_LOWPOWERMODE_SHUTDOWN);

  /* Set SLEEPDEEP bit of Cortex System Control Register */
  SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));

  /* This option is used to ensure that store operations are completed */
#if defined (__CC_ARM)
  __force_stores();
#endif /* __CC_ARM */

  /* Request Wait For Interrupt */
  __WFI();

  /* Following code is executed after wake up if system didn't go to SHUTDOWN
   * or STANDBY mode according to power policy */

  /* Reset SLEEPDEEP bit of Cortex System Control Register */
  CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
}

 

 

Anyone else experienced the same problem ?

0 REPLIES 0