ask for PIT ISR example for CodeWarrior 10.5 MPC5642A (or 5644A)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ask for PIT ISR example for CodeWarrior 10.5 MPC5642A (or 5644A)

Jump to solution
1,778 Views
ZhouYiChuan
Contributor III

Dear NXP experts:
Could you please provide me a MPC5642A(or MPC5644A) PIT ISR example, which is built in CodeWarrior 10.5?

I have such PIT ISR example for S32 DesignStudio and CodeWarrior 2.10.
But for some reason, I have to chose CodeWarrior 10.5 as my IDE.

thanks a lot
YiChaun

0 Kudos
Reply
1 Solution
1,770 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport
0 Kudos
Reply
6 Replies
1,771 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport
0 Kudos
Reply
1,740 Views
ZhouYiChuan
Contributor III

Hello David:

I'm sorry I have to ask for help again.

I've tried your example on my Target board (not an evaluation kit, it's real automotive ECU). 

environment : CodeWarrior 10.5, MPC5642 A

It falls into dead loop in function FMPLL_init(), the debugger snapshot is below:

while (FMPLL.SYNSR.B.LOCK != 1) {};

Init_PLL_Deadloop.PNG

Then , this initialization code block is replaced with  following codes,

(it works well on the ECU, the only problem it that a PIT ISR is required in CodeWarrior 10.5)

FMPLL.SYNCR.R = 0x05080030; /* Initial setting: 40 MHz for 8 MHz crystal */
while (FMPLL.SYNSR.B.LOCK != 1) {}; /* Wait for LOCK = 1 */
FMPLL.SYNCR.R = 0x05080430; /* Enable FM */
while (FMPLL.SYNSR.B.LOCK != 1) {}; /* Wait for FMPLL to LOCK again */
FMPLL.SYNCR.R = 0x05000430; /* Final setting: 112M (X+4)*8 MHz for 8 MHz crystal */

Another error is the SW runs into A trap, please see below:

IO_Trap.PNG

I only changed the main.c. 

The main.c and the whole project are attached. 

thanks and BR

YiChuan

0 Kudos
Reply
1,721 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

I think you have incorrectly configured flash controller.

 

Please open __ppc_eabi_init.c file and add following two lines at the beginning of the file after #include "MPC5642A.h":

#define FLASH_REG FLASH_A.BIUCR.R

#define FLASH_DATA 0x00018C55

 

I believe it’ll solve your issue.

 

Thus right values are

MPC5642A:

Up to 153MHz : 0x00018C55

Up to 100MHz : 0x00016B55

Up to 90MHz  : 0x00014A55

 

MPC5644A:

Up to 153MHz : 0x00019C55

Up to 100MHz : 0x00017B55

Up to 90MHz  : 0x00015A55

0 Kudos
Reply
1,711 Views
ZhouYiChuan
Contributor III

Hello David:

Now the PIT ISR can work, thank you very much. 

My MCU is 5642A. 

Best Regards

Yichuan

0 Kudos
Reply
1,724 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Do you have MPC5644A or MPC5642A? there is a difference in used flash memory there.

0 Kudos
Reply
1,759 Views
ZhouYiChuan
Contributor III

Dear David:

thank you very much. 

I'll try to implement my application based on your example.

 

BR

YiChuan

0 Kudos
Reply