cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476RCT6 – HAL_Delay and UART Blocking Issue on Custom Board

Sk4
Associate II

Hi ST Support Team,

I am working with the STM32L476RCT6 on a custom-designed board for an NFC reader project.

I am facing a critical issue during basic bring-up:

Issue Description

  • The MCU appears to hang when using HAL_Delay() and HAL_UART functions
  • The code runs only during debug (step-over execution), but not in normal run mode
  • In normal execution:
    • HAL_Delay() blocks indefinitely
    • UART transmit functions also get stuck
  • In debug mode:
    • Code executes correctly step-by-step
    • GPIO (LED toggle) works as expected

What I Have Verified

  • Firmware is successfully flashed
  • Minimal project (only GPIO toggle, no complex logic)
  • Using default CubeMX-generated initialization
  • System clock configured to HSI (no external crystal)
  • Issue persists even in a very simple project

Observations

  • Behavior suggests a possible issue with:
    • SysTick / time base not running
    • Interrupts not functioning correctly
    • Or clock configuration problem

Request

Could you please help identify:

  • Why HAL_Delay() is blocking in normal execution but works during debug?
  • What could cause SysTick or interrupts to fail only outside debug mode?
  • Any known issues with STM32L4 series related to this behavior?

Attachments

  • Project source code
  • Clock configuration screenshots

This issue is blocking further development (NFC functionality), so any guidance would be highly appreciated.

Best regards,
Sathish

3 REPLIES 3
mƎALLEm
ST Employee

Hello,

In such case you need to simplify your code as much as possible (toggle a pin) and move forward adding code. Each time you add a piece of code and try to find which block is causing that behavior.

It could be also an issue with priority interrupts. You have an interrupt that is overloading the CPU in standalone mode while in the debug mode it "curbs" the behavior ..

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Sk4
Associate II

Hello Meallem,

Thank you for the quick response.

I created a new project by selecting the STM32L476RCT6 MCU. After generating the project, I added a HAL_Delay() call inside the main loop, followed by a print statement. However, the code gets stuck in the HAL_Delay() function and does not return, even when the delay is set to 1 ms.

No other changes were made apart from adding the delay and print statements in the main loop. Despite this minimal setup, the execution halts within HAL_Delay().

Since this is our custom PCB, could you please review the schematic and help identify any possible issues?

Thanks in advance.

Hello @Sk4 

To debug the issue, you can check whether the SysTick interrupt is occurring or not by toggling a GPIO pin in the

SysTick_Handler.

.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om