Skip to main content
Associate
October 31, 2023
Question

STM32L433 goes to hardfault after certen time lapse

  • October 31, 2023
  • 3 replies
  • 4975 views

Hello everyone,

I am using STM32L433 with external crystal 12MHz. SYSCLK is 72MHz. i am using three usarts (1,2and 3).

but after certain time period of execution lapse. STM32L433 goes to hardfault handler and executiion stucks,

After debug found that it stucks at HAL_Delay() function

 

This topic has been closed for replies.

3 replies

Karl Yamashita
Principal
October 31, 2023

Show your relevant code so we can pin point your issue. 

KnarfB
Super User
October 31, 2023

Check the STM32CubeIE Fault Analyzer output.

rahulgateAuthor
Associate
November 1, 2023

i have checked Fault Analyzer output i have attached fault analyzer log. Every time code is getting stuck in HAL_Delay() function.

Karl Yamashita
Principal
November 1, 2023

That is why i asked you to post your code. I bet you are calling HAL_Delay() from inside an interrupt.

rahulgateAuthor
Associate
November 1, 2023

Hi Karl,

Please find attached my code. 

Karl Yamashita
Principal
November 1, 2023

I see you commented out the HAL_Delay in this delay function. Is it still hard faulting?

void delay(int dly)
{
//	for(int d =0;d<dly;d++)
//	{
//		HAL_Delay(1);
//	}
	start_cnt = 1;
	cnt = 0;
	while(cnt < (dly / 8))
	{

	}
}

 

You've mentioned after certain time period of execution lapse so it can't be the other HAL_Delay before the main while loop. I assume you're getting your LED's to toggle?

So the "delay" function is the only place that calls HAL_Delay unless there is more somewhere else? You haven't shown all your functions so i don't know.