HAL_UARTEx_ReceiveToIdle_IT Causing Hard fault
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-05 6:32 PM - edited ‎2023-11-20 3:53 AM
I was using HAL_UARTEx_ReceiveToIdle_IT to receive data on modbus. After running for couple minutes without any issues it hits the HardFault_Handler.
My registers at the time of HardFualt
any help would be much appreciated
- Labels:
-
Modbus
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-06 9:37 AM
You need to look at the fault registers (CFSR, and possibly MMFAR and BFSR). CubeIDE has a built-in fault analyzer. Those registers will tell you the PC of the instruction that failed. Also search the forums for fault handler for links to some sample code.
You don't say which CPU you are using. On at least some of the M4 CPUs the bus fault, usage fault and memory manager faults are disabled by default. And when disabled these are automatically escalated to a hard fault.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-06 9:40 AM
Going to need to show what instructions are at/before the PC to contextualize the failure.
Do a disassembly.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-06 10:20 AM
For HAL check instances/structures are initialized and passed correctly before use by interrupts.
Some CMx are more sensitive that others to alignment.
The faulting code should provide insight into the specific pointers or records causing grief.
Up vote any posts that you find helpful, it shows what's working..
