Good day
I use imxrt1061 running ThreadX RTOS in my project. During the stability runs we occasionally can catch hard fault. It is hard to reproduce it and it occurs under unknown circumstances. It may occur approximately one time per 5000 test runs.
Usually it happens after controlled reboot - all activities are done, reboot initiated, main application (init thread) starts and during init thread execution it may fail
Here is a listing part (all functions inside CLOCK_SetLowSpeed call are located in I-TCM RAM)
601020d0 <CLOCK_SetLowSpeed>:
601020d0: b580 push {r7, lr}
601020d2: af00 add r7, sp, #0
601020d4: f14c fd80 bl 6024ebd8 <__CLOCK_SystemCoreClockSwitchLowPower_veneer>
601020d8: f14c fd82 bl 6024ebe0 <__CLOCK_DeinitArmPll_veneer>
601020dc: f7ff ff8a bl 60101ff4 <CLOCK_ConfigSysPll>
601020e0: 2000 movs r0, #0
601020e2: f14c fd3d bl 6024eb60 <__CLOCK_DeinitSysPfd_veneer>
601020e6: 2001 movs r0, #1
601020e8: f14c fd3a bl 6024eb60 <__CLOCK_DeinitSysPfd_veneer>
601020ec: 2118 movs r1, #24
601020ee: 2002 movs r0, #2
601020f0: f14c fd56 bl 6024eba0 <__CLOCK_InitSysPfd_veneer>
601020f4: 2003 movs r0, #3
601020f6: f14c fd33 bl 6024eb60 <__CLOCK_DeinitSysPfd_veneer>
601020fa: f14c fd55 bl 6024eba8 <__CLOCK_DeinitUsb2Pll_veneer>
601020fe: f14c fd1b bl 6024eb38 <__CLOCK_DeinitAudioPll_veneer>
60102102: f14c fd11 bl 6024eb28 <__CLOCK_DeinitVideoPll_veneer>
60102106: f14c fce3 bl 6024ead0 <__CLOCK_DeinitEnetPll_veneer>
6010210a: f14c fd5d bl 6024ebc8 <__CLOCK_SystemCoreClockSwitchLowSpeed_veneer>
6010210e: 46bd mov sp, r7
60102110: e8bd 4080 ldmia.w sp!, {r7, lr}
60102114: f05f be04 b.w 60161d20 <SystemCoreClockUpdate>
and a stack printout
REBOOT OCCURED\n",
TYPE: HARD FAULT\n",
--- Stack frame -------------------------------------------------------\n",
IPSR= 0x00000003 >>>>> HardFault <<<<\n",
R0 = 0x00000008\n",
R1 = 0x5018505B\n",
R2 = 0x400D8000\n",
R3 = 0x00000080\n",
R12 = 0x00000280\n",
LR = 0x601020E7\n",
PC = 0x60102100\n",
PSR = 0x0100000E\n",
SP (when faulted) = 0x20077F08\n",
--- System Control Block (SCB) ----------------------------------------\n",
0x00080000 - CFSR - Configurable Fault Status Register\n",
> The processor has attempted to access a coprocessor\n",
0x40000000 - HFSR - HardFault Status Register\n",
> Forced HardFault\n",
0x411FC271 - CPUID - CPUID Base Register\n",
0x00481003 - ICSR - Interrupt Control and State Register\n",
0x60100400 - VTOR - Vector Table Offset Register\n",
0xFA050000 - AIRCR - Application Interrupt and Reset Control Register\n",
0x00000000 - SCR - System Control Register\n",
0x00070200 - CCR - Configuration Control Register\n",
0x00F00000 - CPACR - Coprocessor Access Control Register\n",
Please advise how this issue can be localized. Any suggestions are appreciated. Thank you