Hello, all.
I am using MPC5777C in vehicle controller. and I am building my project by referring to NXP's example.
The problem is that the external ISR executes once, the external ISR doesn't executes again.
I would like to know a method I found is correct.
Below is the mechanism I analyzed why the ISR does not work again.
1. After ISR, Writing to the INTC_EOIR_PRC for sending the end signal of the servicing of the interrupt request on epilog.
2. In case of PIT interrupt, after writing INTC_EOIR_PRC, INTC_CPR_PRC is changed automatically in epilog. and then, PIT ISR will executes again after PIT timeout interrupt arise.
3. In case of external interrupts, INTC_CPR_PRC is NOT changed in epilog. and external ISRs do not executes again.
I have confirmed that adding writing INTC_EOIR_PRC in the external ISR makes the ISR continuously work well. To summarize, Writing INTC_EOIR_PRC twice for an interrupt event.
Writing INTC_EOIR_PRC at first time doesn't change INTC_CPR_PRC, but at the second time change INTC_CPR_PRC.
But I have doubts about whether this method is correct.
Object is that external ISRs process while the PIT ISR is running.
The solution that I found is fit to my object, That situation doesn't make sense for me..
Reference projects are below:
- Example MPC5777C-SIUL_External_NMI GHS714
- Example MPC5777C-SIUL_External_IRQ GHS714
Below is my sample code.
void Initialize_Interrupt(void){
// PIT Interrupt Setting
PIT.MCR.R = 0;
PIT.TIMER[0].TFLG = 1; // Timer Int. Flag Clear
PIT.TIMER[0].TCTRL = 3; // Timer Enable, Timer Int. Enable
PIT.TIMER[0].LDVAL = 24000000 - 1; // Timeout Period
// External Interrupt Setting
SIU.MCR.R = 0;
INTC.IACKR_PRC[0].R = (uint32_t)&INTC_IVT; // Setting Vector Table
SIU.DIRER.R = 0x0000FFFF; // Int. Enable
SIU.IFEER.R = 0x0000FFFF; // Falling-Edge
SIU.IREER.R = 0x00000000; // Rising-Edge
SIU.PCR[450~455] = 0x0913;
SIU.IMUX3.B.MUXSEL0~5 = 1; // Input Mux. IRQ 0~5
// Priority Setting
INTC.PSR[50] = 4; // Core0, Ext Isr, Priority 4 (Higher)
INTC.PSR[301] = 3; // Core0, PIT Isr, Priority 3
}
void isr_ISR5(void){
// Clear Int. Flag
SIU.EISR.R = 0x80;
// Do Something
// Writting INTC_EOIR_PRC as 0
INTC.EOIR_PRC[0].R = 0; // Is it Correct? But It goes as planned
}
void isr_PIT0(void){
// Clear Int. Flag
PIT.TIMER[0].TFLG = 1;
// Do Something
}
Thanks in advance.