Skip to main content
Associate
August 30, 2023
Solved

Using CubeIDE code breaks with HAL_Delay() at uwTick on HAL_GetTick

I'm using a custom board with a STM32L431RCT6 MCU and I need to activate the Ultra Low Power modes on it. I'm trying to use HAL_Delay before HAL_PWR_EnterSTANDBYMODE() and that's where the code breaks. Does anyone have any sugestion on how to fix the problem?
I'm a beginner using CubeIDE and using microcontrollers in general.

    This topic has been closed for replies.
    Souhaib MAZHOUDBest answer
    ST Technical Moderator
    August 30, 2023

    Hi @Bajoras 

    Thank you for posting.

    Try to configure WakeUP4 Pin (you can configure it with STM32CubeMX : System Core>SYS>Mode) before you run HAL_PWR_EnterSTANDBYMode(); 

    Thank you.

    Souhaib

    To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.

    5 replies

    TDK
    August 30, 2023

    Sounds like you might be disabling SysTick before entering standby, in which case HAL_Delay won't work. You should still disable SysTick, but you can't use HAL_Delay after that point.

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    Souhaib MAZHOUDBest answer
    ST Technical Moderator
    August 30, 2023

    Hi @Bajoras 

    Thank you for posting.

    Try to configure WakeUP4 Pin (you can configure it with STM32CubeMX : System Core>SYS>Mode) before you run HAL_PWR_EnterSTANDBYMode(); 

    Thank you.

    Souhaib

    To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
    BajorasAuthor
    Associate
    September 4, 2023

    Hello, thank you for the fast response! It works, I just needed to activate WakeUP4 Pin, but why does it work doing just that? I didn't include anything related to the WakeUP4 Pin in my code, just checking it in the .ioc file did the trick. Can someone explain it to me, please?

    Piranha
    Principal III
    September 7, 2023
    BajorasAuthor
    Associate
    September 11, 2023

    I found out later that I didn't really need the WakeUP4Pin and the code was actually breaking within the HAL_PWR_EnterSTANDBYMODE(), I needed to reallocate the vector table by uncommenting the line 126 at "system_stm32l4xx.c". Thanks for the responses