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!
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:
Best regards,
Peter
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.
Here you can see the interrupt triggered by PIT example.
Best regards,
Peter