2020-03-19 02:26 AM
SOS
I have tried the other forum suggestions but nothing seems to work so far for me. Basically I am just trying to turn an LED on/off with a set delay:
while (1)
{
/* USER CODE END WHILE */
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, 0);
HAL_Delay(1000);
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, 1);
/* USER CODE BEGIN 3 */
}
It just hangs at HAL_Delay(1000). I am using a STM32L496G-DISCO board.
Solved! Go to Solution.
2020-03-19 04:43 AM
What happens if you step into HAL_Delay ?
What does 'hanging' exactly mean?
Btw: You need another delay to see the LED blinking, because its now 1000ms on + 0ms off.
2020-03-19 04:06 AM
Hi @retro
Check your RCC clock config.
2020-03-19 04:12 AM
is that in the .ioc - clock configuration? I cannot see anything about RCC
2020-03-19 04:43 AM
What happens if you step into HAL_Delay ?
What does 'hanging' exactly mean?
Btw: You need another delay to see the LED blinking, because its now 1000ms on + 0ms off.
2020-03-19 04:58 AM
@retro
Are you using CubeMx for auto code generation ?
Which board are you using ?
Did you config GPIO port Pin as output ?
/*********************************
I Set GPIOC pin 0 as output.
while(1)
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET);
HAL_Delay(1000);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET);
HAL_Delay(1000);
}
/*********************************
Still facing issue let me know.
2020-03-19 05:11 AM
Yes this was the problem - I am actually smart I swear
2020-03-19 05:12 AM
Yes, I did not put another delay after that - do not judge me - it works now!
2020-03-19 05:39 AM
Well that is great.
I am not judging you. I am surprised that why did you think so.