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!