MQX Lite Problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,393件の閲覧回数
pk2
Contributor III

I am trying to use MQX Lite on a K52 and am having a problem with a simple application.  I created a MQX Lite project for a K52 and did nothing other than generate the PE files and build the project.  When I debug the debugger stops here:

 

PE_ISR(Cpu_ivINT_Hard_Fault)

{

  /* This code can be changed using the CPU component property "Build Options / Unhandled int code" */

  PE_DEBUGHALT();

}

 

Any ideas why this happens?

 

Files attached (Archive of the project)

Original Attachment has been moved to: test03.zip

1 解決策
2,026件の閲覧回数
anthony_huereca
NXP Employee
NXP Employee

Yes, that K52 part is a rev 1.x part. Make sure you select MK52DN512Z when creating an MQX-Lite project. If you select that version, you'll see that MCG_C7 isn't called at all anymore in CPU.c

-Anthony

元の投稿で解決策を見る

9 返答(返信)
2,026件の閲覧回数
c0170
Senior Contributor III

Hello pk2,

can you debug your application? First, You should find out which line causes hard fault. There are posts here on the forum how to find out where it invoked the hard fault or use google.

I would be looking at your initialization of peripherals, you might have missed to initialize a peripheral module (for instance).

Regards,

0xc0170

0 件の賞賛
返信
2,025件の閲覧回数
pk2
Contributor III

Martin -

After the code is loaded into the processor, the debugger immediately goes to the place in my first post - before I click on run!  It fails immediately before any code is executed.

My question is why doesn't Code Warrior generate such a simple project properly?  I am new to MQX Lite and this is just frustrating. 

0 件の賞賛
返信
2,026件の閲覧回数
anthony_huereca
NXP Employee
NXP Employee

Hi pk2,

  By default, the debugger settings will cause the code to run to main() before halting.  Take a look at this post to make the debugger stop on the very first instruction in the code instead, so you can step through the code and see where it's crashing: Re: MQX on custom board stuck in dispatch.s

  There is quite a bit of low-level initialization code that happens between boot and main(), so incorrect system clock setup, not enabling peripheral clocks, or VBAT/RTC issues (like described in the thread I linked to) can cause MQX to crash on a custom board before the code make it to main(). They have the same symptoms that you are seeing. Try stepping through the code from the first instruction, and see if you can spot where it's failing for your custom board.

-Anthony

Edit: Also make sure you are using the correct K52 100MHz processor family selection, as there are 1.x and 2.x versions and it can cause a bunch of problem if you're running 1.x code on a 2.x processor and vice versa. If your part number has a "Z" in it, it's a 1.x, and if not, then it's a 2.x.

2,026件の閲覧回数
pk2
Contributor III

Thanks for the information Anthony.  I changed the debugger settings to start at program execution.  I stepped thru the code and get to the following lines in Cpu.c:

  OSC_CR = OSC_CR_ERCLKEN_MASK;           (this line executes ok)                  

  /* MCG_C7: OSCSEL=0 */

  MCG_C7 &= (uint8_t)~(uint8_t)(MCG_C7_OSCSEL_MASK);

(when I step on this line the program goes to the section in the original post)

The line I made bold the program goes to the section in my original post.

My design does not have a RTC.  I also tried this project using a TWRK60N512 and I am getting the same result. 

This may be a stupid question... does MQX Lite use BSP's?

Thanks for your help.

0 件の賞賛
返信
2,026件の閲覧回数
anthony_huereca
NXP Employee
NXP Employee

Hi pk2,

  What is the full part number of the chip you are using? MCG_C7 is a new register that is only in Kinetis 100MHz 2.x, so if you are using a 1.x 100Mhz part that would be why it's crashing. It also explains why it crashes on the TWR-K60N512 board, as that has a Kinetis 100MHz 1.x part.

  The BSP in MQX Lite is generated by Processor Expert.

Regards,

Anthony

0 件の賞賛
返信
2,026件の閲覧回数
pk2
Contributor III

PK60N512VMD100

MK52DN512ZCLQ10

0 件の賞賛
返信
2,027件の閲覧回数
anthony_huereca
NXP Employee
NXP Employee

Yes, that K52 part is a rev 1.x part. Make sure you select MK52DN512Z when creating an MQX-Lite project. If you select that version, you'll see that MCG_C7 isn't called at all anymore in CPU.c

-Anthony

2,026件の閲覧回数
pk2
Contributor III

Thank you Anthony.  That was the problem.  I figured it was something easy.   I now have my simple MQX Lite project running on the K52 now... I can print  "Hello world"!!! Thanks again for your help.  This problem is solved.

0 件の賞賛
返信
2,026件の閲覧回数
pk2
Contributor III

Martin -

After the code is loaded into the processor, the debugger immediately goes to the place in my first post - before I click on run!  It fails immediately before any code is executed.

My problem question is why doesn't Code Warrior generate such a simple project properly?  I am new to MQX Lite and this is just frustrating.

0 件の賞賛
返信