connecting SWO pin is causing Hard Fault Exception(unaligned memory access)
Hi,
I got a strange behavior during debugging my bare metal application on STM32F745ZGTx. The emulator is ST-Link V2, with "B 2018 02" printed on the back. The Hard Fault exception (unaligned memory access) is triggered randomly. I mean, the PC causing problem is not at the same place, but randomly. The trouble-shooting steps I have taken:
- Originally I suspect it is related to the power supply or PLL clock. So I enabled the Brown-out reset and switched to internal HSI. But the problem is still there.
- Then I suspect the IDE. I tried both Keil and IAR. The problem is seen on both IDEs.
- I upgraded my ST-link firmware. The issue is still there.
- Removing SWO connection, but keep the source intact, and keep the SWDIO/SWCLK. This time, the problem is gone.
So it seems the SWO connection is causing the problem. But I am sure the connection is fine, as I can saw the printf content when SWO is connected.
Do you have any idea about the problem? Please see the attached pictures for the crash, and the attached ioc file for my configuration. Thanks in advance.
BR
/Li
Add one more point: I tried to disable the ITM redirect IO and disabled the printf code directly. In such case, if the SWO pin from ST-Link V2 is still connected to the target, the problem will rise too.
