cancel
Showing results for 
Search instead for 
Did you mean: 

Deepsleep as low power mode cause stm32c0 do not enter its interrupt if run as normal(powerUp only)

Hollis_K
Associate III

Hi, when configure MCU to deep sleep mode as the low power mode, it seems okay when debugging. But, when only power up STM32C0 by just connected its vcc and ground, it do not enter its interrupt. How can I solve it?

My project goals are to achieve lowest current consumption and MCU able to communication with other modules through I2C and USART. Those communication protocols are triggered by its interrupt using timer1.

int main(void)
{
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_TIM1_Init();
  MX_I2C1_Init();
  MX_USART1_UART_Init();
  /* USER CODE BEGIN 2 */
  LPS_Init();
 
  LL_PWR_SetPowerMode(LL_PWR_MODE_STOP0);
  LL_LPM_EnableDeepSleep();
 
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  __NOP();
    /* USER CODE END WHILE */
  if(fsleep==1){
  __WFI();
  }
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}
 
communication flow::
timer -> I2C -> usart 
timer will trigger i2c interrupt to read info and send the data to usart (TX)
 
Thanks.
7 REPLIES 7
gbm
Lead II

In deep sleep the standard peripherals are turned off, so they cannot wake up the processor. Read the manual and check how can you wake up the MCU from deep sleep.

Hello,

I have checked, it can work in deep sleep. But i try debug, it does wake up from deep sleep....

gbm
Lead II

TIMx timers are stopped in stop mode. In the code above I cannot see any peripherals being activated, so they cannot generate any interrupts.

Hollis_K
Associate III

Then, any suggested peripheral use in deep sleep mode and able wake up the i2c and uart communication?

gbm
Lead II

Use RTC for periodic wakeup. UART may wake up on incoming transmisssion.

As @gbm suggested you can use USART1 to wake up from stop 0, but as far as I know (from L0 and L4 uC) you must have LSI enabled and running, and USART1 must use LSI as its clock source (which means that you can't have high baud rate).

I don't know about I2C.

In any case check the C0 reference manual.

Thank you for the information. I have solved my case by implementing the provided info and methods.