Skip to main content
Visitor II
May 24, 2024
Question

why STM32F303 stop at HAL_TIM_Base_Start_IT(Help)

  • May 24, 2024
  • 1 reply
  • 915 views

I found a issue.

if the code is

HAL_PWR_DisableSleepOnExit();

HAL_TIM_Base_Start_IT(&htim2);

 

it will stop at "if (IS_TIM_SLAVE_INSTANCE(htim->Instance))", but i didnt set break point at here.

if i change code:

HAL_TIM_Base_Start_IT(&htim2);

HAL_PWR_DisableSleepOnExit();

it will run success

Does anyone know anything about this?

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    May 26, 2024

    Dear @Zuo ,

    Welcome in our Community and thank you for the contribution. Is that possible to know the compiler used and also the Optimization level that generates this issue . If you can share the generated assembly to understand how the CPU sleep is entered ? It seems a scheduling timing issue and best to ensure that that disabling SleepOnExit is already propagated to the core register .

    Hope it helps .

    STOne-32

    ZuoAuthor
    Visitor II
    May 27, 2024

    Dear @STOne-32 

     

    Thanks for your reply. Sorry, I misrepresented it. It's not HAL_PWR_DisableSleepOnExit(). It's HAL_PWR_EnableSleepOnExit.

    Zuo_0-1716777668661.png

    It will stop at "if (IS_TIM_SLAVE_INSTANCE(htim->Instance))".

    I also check the assembly language and register .It seems not this issue.

    The optimization level is -O0. It seems not this issue too.

    I put whole code at here https://drive.google.com/file/d/1C0Okxb4L-GLFftIXyY93LVBHNR7QFbBk/view?usp=sharing