2023-10-31
10:32 AM
- last edited on
2023-11-02
03:53 AM
by
Lina_DABASINSKA
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
2023-10-31 01:26 PM
Show your relevant code so we can pin point your issue.
2023-10-31 01:48 PM
Check the STM32CubeIE Fault Analyzer output.
2023-10-31 07:31 PM
2023-10-31 07:50 PM
That is why i asked you to post your code. I bet you are calling HAL_Delay() from inside an interrupt.
2023-10-31 11:30 PM
2023-11-01 02:46 AM
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.
2023-11-01 05:32 AM
pc == 0 should not happen. Look for undefined (NULL) interrupt handlers or function pointers or stack overwrites. The lr register tells you the return address of a function call, inpect that code and try setting a breakpoint shortly before taht address.
hth
KnarfB