Resolved! Calling the HAL_Delay() function after __HAL_DBGMCU_FREEZE_IWD() results in an infinite waiting state.
In debug mode, __HAL_DBGMCU_FREEZEZE_IWD() was used to stop the IWDG. Later, the HAL_Delay() function results in an infinite waiting state. I'd appreciate it if you could let me know the cause and solution.