cancel
Showing results for 
Search instead for 
Did you mean: 

How to go into stop mode with FreeRTOS running on an STM32L073 board. HAL_SuspendTick() is not working while using FreeRTOS?

VWied.1
Associate III

I am trying to use stop mode with the STM32L073 chip. I am able to get my code working while I am not using FreeRTOS on the STM32L073. I am also able to get this working on the STM32G0 Nucleo board with FreeRTOS.

When I start using FreeRTOS on the STM32L073, I am getting timer interrupts on the systick Timebase source I am using. TIM7 in this case.

I believe after reading up on this that HAL_SuspendTick() should be stopping all TIM7 interrupts on my system until I call HAL_ResumeTick();

  //Last community.st.com solution to deal with this problem was to only include the 2 interrupts of RTC and button interrupt. That is what this tempEXTIIMR value is.
  volatile uint32_t tempEXTIIMR = 0;
  tempEXTIIMR = EXTI->IMR;
  //Disable all but RTC wake up source and ON_OFF_BUTTON
  //EXTI_IMR_IM3 is the bitfield for the ON_OFF_BUTTON's interrupt
  EXTI->IMR = RTC_EXTI_LINE_WAKEUPTIMER_EVENT | EXTI_IMR_IM3;
 
  HAL_SuspendTick();
  osThreadSuspendAll();
 
  HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI);
 
  SystemClock_Config();
  HAL_ResumeTick();
 
  EXTI->IMR = tempEXTIIMR;
 
  HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
  osThreadResumeAll();

1 ACCEPTED SOLUTION

Accepted Solutions
VWied.1
Associate III

So I tried to recreate the issue. Now it works fine if I am debugging or not. I didn't change anything so that is a bit concerning...

View solution in original post

2 REPLIES 2

Hello @VWied.1​ 

Was this behavior observed during an active debugging session?

BeST Regards,

Walid

VWied.1
Associate III

So I tried to recreate the issue. Now it works fine if I am debugging or not. I didn't change anything so that is a bit concerning...