STM32 HAL_Delay doesn't work properly
Hello,
I'm in the process of learning the STM32 MCU. I have the STM32F4DISCOVERYBOARD with a STM32F407VGT on it.
At first I tried the simple LED blink tutorial and noticed that the LED will light up, but won't blink.
I did some more attempts and figured that the HAL_Delay() function doesn't work properly.
These are my configurations in CubeMX; I didn't change anything afterwards in the initialization code generated by CubeMX.



Using CubeMX I defined an output pin, wrote a simple code where I can change the on and off time of the pin and connected it to an oscilloscope.
// #1
while(1)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_SET);
HAL_Delay(600);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_Delay(600);
}#1
#1: Signal stays high and has spike every 480ms
//#2
while(1)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_SET);
HAL_Delay(50);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_RESET);
HAL_Delay(10);
}


#2: HIGH for 50ms and one impuls lasts for 33ms, LOW for 10ms as defined
I also tried the TooglePin function and also changed the clock frequency randomly, but nothing worked. Do you know where my mistakes is or what I could do in order to make HAL_Delay work properly?
I also read somewhere that the HAL_Delay is used for HAL functions. I guess the problem will affect them as well right?
