MPC5744P set interrupts

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MPC5744P set interrupts

965 次查看
billie60
Contributor I

Hello. I'm trying to set an interrupt for MPC5744P. I set :

void enableIrq(void) {

#if !defined(MPC574xP)
uint16_t coreId = GetCoreID ();
#endif

/* Ensure INTC's current priority is 0 */
#if defined(MPC574xP)
INTC.CPR0.R = 0U;
#elif defined(MPC574xR)
/* Ensure INTC's current priority is 0 */
if (coreId) INTC_0.CPR[1].R = 0U;
else INTC_0.CPR[0].R = 0U;
#elif defined(MPC5777C)
INTC.CPR_PRC[coreId].R = 0U;
#elif defined(MPC574xC)
/* Ensure INTC's current priority is 0 */
if (coreId) INTC.CPR1.R = 0U;
else INTC.CPR0.R = 0U;
#else
/* Ensure INTC's current priority is 0 */
INTC.CPR[coreId].R = 0U;
#endif
/* Enable external interrupts */
PPCASM (" wrteei 1 ");
}

to set the value of INTC_CPR0 register.And I set 

#define MTSPR(rn, v) PPCASM volatile("mtspr " stringify(rn) ",%0" : : "r" (v))

void SetIVPR (register unsigned int x)
{
MTSPR(63, x);
}

to init the IVPR register.

At last, I use the xcptn_xmpl function to encapsulate these initializations and call them in the main.c 

void xcptn_xmpl(void) {

/* Initialise Core IVPR */
SetIVPR ((unsigned int) &VTABLE);
#if defined(MPC5777C)
InitIVORS();
#endif
/* Initialize INTC for SW vector mode */
InitINTC();

/* Enable interrupts */
enableIrq();
}

However, when I check the all register view, those registers' values are not as I set. I tried to add the code to change the value of the general register in the enableIrq function, and the general register was successfully changed. I also tried to add  INTC.CPR0.B.PRI = 0  to the main function and break the point on the next line,  The value of INTC_CPR has not changed. What is the reason for this?

THANKS!

0 项奖励
回复
3 回复数

950 次查看
petervlna
NXP TechSupport
NXP TechSupport

Hello,

However, when I check the all register view, those registers' values are not as I set.

I expect you are not applying any register protection. So if your registers are not set then your SW is simply not executing the code to set them.

Simply debug application and find out why it is not executing them. Most probably it is some branching.

 

You can also have a look at example codes:

https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5744P-PinToggleStationery-S32DS-1-0/t...

 

Best regards,

Peter

0 项奖励
回复

948 次查看
billie60
Contributor I

Hello, peter.

I have downloaded the example. But I cannot build it. And the component of this example is unable to see. Whether any options need to be changed to view the components configured to the project? And how can I build it?

best wishes!

0 项奖励
回复

944 次查看
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Did you used version of S32DS 1.0 for which the example is created? As you want to compile the project.

I expect that project is already compiled and there is no need to compile it again.

However, here is example which is compiled and ready to run once you load program to micro. I have only used startup from GHS, rest is handwritten without any drivers to make it simple.

https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5744P-PIT-triggering-interrupts/ta-p/...

Here you can see the interrupt triggered by PIT example.

Best regards,

Peter

0 项奖励
回复