Hi Folks,
I have A TWR-K60N512 KIT with the TWR-K60N512, two elevator boards, and the TWR-SER board. Using KSDK 1.3, I am simply trying to build, load, and run the hello_world demo using IAR Embedded Workbench 7.40.3. I am using a J-Link pod from Segger as my JTAG connection.
The ksdk_platform_lib project builds fine, no errors. The hello_world project also builds fine, no errors. I can download the project into Flash without errors.
However, when the code gets into CLOCK_HAL_PrepareOsc(), it fails with a HardFault. This function is in fsl_mcg_hal.c. The failure appears to be happening at the line:
if (MCG_BRD_C2_EREFS(base))
In the disassembly window, I can see the following code:
MCG_BWR_C7_OSCSEL(base, setting);
0x1176: 0xf114 0x000c ADDS.W R0, R4, #12 ; 0xc
0x117a: 0x0140 LSLS R0, R0, #5
0x117c: 0xf110 0x4084 ADDS.W R0, R0, #1107296256 ; 0x42000000
0x1180: 0x7005 STRB R5, [R0]
if (kMcgOscselOsc == setting)
0x1182: 0xb2ed UXTB R5, R5
0x1184: 0x2d00 CMP R5, #0
0x1186: 0xd10c BNE.N 0x11a2
if (MCG_BRD_C2_EREFS(base))
0x1188: 0x1c60 ADDS R0, R4, #1
0x118a: 0x0140 LSLS R0, R0, #5
0x118c: 0xf8df 0x1348 LDR.W R1, [PC, #0x348] ; [0x14d8] 0x42000008 (1107296264)
0x1190: 0x5c08 LDRB R0, [R1, R0]
0x1192: 0xb2c0 UXTB R0, R0
0x1194: 0x2800 CMP R0, #0
0x1196: 0xd004 BEQ.N 0x11a2
while(!CLOCK_HAL_IsOsc0Stable(base)){}
0x1198: 0x0020 MOVS R0, R4
0x119a: 0xf7ff 0xffc8 BL CLOCK_HAL_IsOsc0Stable ; 0x112e
0x119e: 0x2800 CMP R0, #0
Whenever I try to execute the code at 0x118c, the code immediately goes to HardFault_Handler at location 0xe66.
Any idea what could be causing this? Not sure if I have something configured incorrectly in board.h, or if I have incorrect jumper settings on either the processor board or the serial board.
Any help is greatly appreciated!
Scott