[MPC5777C] Interrupts are not called after a external ISR call

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

[MPC5777C] Interrupts are not called after a external ISR call

Jump to solution
1,705 Views
byungwouk
Contributor II

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.

0 Kudos
Reply
1 Solution
1,609 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

I have added PIT to the External IRQ example, but I don't see mentioned behavior.

One LED is blinking by EIRQ button, second by PIT interrupt.

View solution in original post

0 Kudos
Reply
4 Replies
1,610 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

I have added PIT to the External IRQ example, but I don't see mentioned behavior.

One LED is blinking by EIRQ button, second by PIT interrupt.

0 Kudos
Reply
1,588 Views
byungwouk
Contributor II

Thank you for testing about that.

The reason that my project has problem is my fault.

I did add some logging code in ISR to know the order of interrupts called.

It seems that reading INTC.IACKR_PRC in IRQ makes interrupt wrong.

 

Thank you so much!

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

I don't understand it too much as write to EOIR register is present in the epilog. From core point of view there is no difference between external interrupt and other IVOR4 sources.

I will check it on HW when I am able, letting you know.

0 Kudos
Reply
1,696 Views
byungwouk
Contributor II
In addition, prolog and epilog are same with the examples
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1966675%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%5BMPC5777C%5D%20Interrupts%20are%20not%20called%20after%20a%20external%20ISR%20call%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1966675%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%20all.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20am%20using%20MPC5777C%20in%20vehicle%20controller.%20and%26nbsp%3BI%20am%20building%20my%20project%20by%20referring%20to%20NXP's%20example.%3C%2FP%3E%3CP%3EThe%20problem%20is%20that%20the%20external%20ISR%20executes%20once%2C%20the%20external%20ISR%20doesn't%20executes%20again.%3C%2FP%3E%3CP%3EI%20would%20like%20to%20know%20a%20method%20I%20found%20is%20correct.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EBelow%20is%20the%20mechanism%20I%20analyzed%20why%20the%20ISR%20does%20not%20work%20again.%3C%2FP%3E%3CP%3E1.%20After%20ISR%2C%20Writing%20to%20the%20%3CSTRONG%3EINTC_EOIR_PRC%26nbsp%3B%3C%2FSTRONG%3Efor%20sending%20the%20end%20signal%20of%20the%20servicing%20of%20the%20interrupt%20request%20on%26nbsp%3Bepilog.%3C%2FP%3E%3CP%3E2.%20In%20case%20of%20PIT%20interrupt%2C%20after%20writing%20%3CSTRONG%3EINTC_EOIR_PRC%3C%2FSTRONG%3E%2C%20%3CSTRONG%3EINTC_CPR_PRC%3C%2FSTRONG%3E%20is%20changed%20automatically%20in%20epilog.%20and%20then%2C%20PIT%20ISR%20will%20executes%20again%20after%20PIT%20timeout%20interrupt%20arise.%3C%2FP%3E%3CP%3E3.%20In%20case%20of%20external%20interrupts%2C%26nbsp%3B%3CSTRONG%3EINTC_CPR_PRC%3C%2FSTRONG%3E%20is%20%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3ENOT%3C%2FSTRONG%3E%20%3C%2FFONT%3Echanged%20in%20epilog.%20and%20external%20ISRs%20do%20not%20executes%20again.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20have%20confirmed%20that%20adding%20writing%20%3CSTRONG%3EINTC_EOIR_PRC%3C%2FSTRONG%3E%26nbsp%3Bin%20the%20external%20ISR%20makes%20the%20ISR%20continuously%20work%20well.%20To%20summarize%2C%20Writing%20%3CSTRONG%3EINTC_EOIR_PRC%3C%2FSTRONG%3E%20twice%20for%20an%20interrupt%20event.%3C%2FP%3E%3CP%3EWriting%20%3CSTRONG%3EINTC_EOIR_PRC%3C%2FSTRONG%3E%20at%20first%20time%20doesn't%20change%20%3CSTRONG%3EINTC_CPR_PRC%3C%2FSTRONG%3E%2C%20but%20at%20the%20second%20time%20change%20%3CSTRONG%3EINTC_CPR_PRC%3C%2FSTRONG%3E.%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I%20have%20doubts%20about%20whether%20this%20method%20is%20correct.%3C%2FP%3E%3CP%3EObject%20is%20that%20external%20ISRs%20process%20while%20the%20PIT%20ISR%20is%20running.%3C%2FP%3E%3CP%3EThe%20solution%20that%20I%20found%20is%20fit%20to%20my%20object%2C%20That%20situation%20doesn't%20make%20sense%20for%20me..%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EReference%20projects%20are%20below%3A%3C%2FP%3E%3CP%3E-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FMPC5xxx-Knowledge-Base%2FExample-MPC5777C-SIUL-External-NMI-GHS714%2Fta-p%2F1118201%22%20target%3D%22_self%22%3EExample%20MPC5777C-SIUL_External_NMI%20GHS714%3C%2FA%3E%3C%2FP%3E%3CP%3E-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FMPC5xxx-Knowledge-Base%2FExample-MPC5777C-SIUL-External-IRQ-GHS714%2Fta-p%2F1116848%22%20target%3D%22_self%22%3EExample%20MPC5777C-SIUL_External_IRQ%20GHS714%3C%2FA%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EBelow%20is%20my%20sample%20code.%3C%2FP%3E%3CP%3Evoid%20%3CSTRONG%3EInitialize_Interrupt%3C%2FSTRONG%3E(void)%7B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20PIT%20Interrupt%20Setting%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20PIT.MCR.R%20%3D%200%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20PIT.TIMER%5B0%5D.TFLG%20%3D%201%3B%20%26nbsp%3B%2F%2F%20Timer%20Int.%20Flag%20Clear%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20PIT.TIMER%5B0%5D.TCTRL%20%3D%203%3B%20%2F%2F%20Timer%20Enable%2C%20Timer%20Int.%20Enable%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20PIT.TIMER%5B0%5D.LDVAL%20%3D%2024000000%20-%201%3B%20%2F%2F%20Timeout%20Period%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20External%20Interrupt%20Setting%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SIU.MCR.R%20%3D%200%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20INTC.IACKR_PRC%5B0%5D.R%20%3D%20%26nbsp%3B(uint32_t)%26amp%3BINTC_IVT%3B%20%2F%2F%20Setting%20Vector%20Table%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SIU.DIRER.R%20%3D%200x0000FFFF%3B%20%2F%2F%20Int.%20Enable%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SIU.IFEER.R%20%3D%200x0000FFFF%3B%20%2F%2F%20Falling-Edge%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SIU.IREER.R%20%3D%200x00000000%3B%20%2F%2F%20Rising-Edge%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SIU.PCR%5B450~455%5D%20%3D%200x0913%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SIU.IMUX3.B.MUXSEL0~5%20%3D%201%3B%20%2F%2F%20Input%20Mux.%20IRQ%200~5%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20Priority%20Setting%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20INTC.PSR%5B50%5D%20%26nbsp%3B%3D%204%3B%20%2F%2F%20Core0%2C%20Ext%20Isr%2C%20Priority%204%20(Higher)%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20INTC.PSR%5B301%5D%20%3D%203%3B%20%2F%2F%20Core0%2C%20PIT%20Isr%2C%20Priority%203%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Evoid%20%3CSTRONG%3Eisr_ISR5%3C%2FSTRONG%3E(void)%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20Clear%20Int.%20Flag%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SIU.EISR.R%20%3D%200x80%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20Do%20Something%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20Writting%20INTC_EOIR_PRC%20as%200%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%26nbsp%3B%20%26nbsp%3B%20INTC.EOIR_PRC%5B0%5D.R%20%3D%200%3B%20%2F%2F%20Is%20it%20Correct%3F%20But%20It%20goes%20as%20planned%3C%2FFONT%3E%3CBR%20%2F%3E%7D%3CBR%20%2F%3Evoid%20%3CSTRONG%3Eisr_PIT0%3C%2FSTRONG%3E(void)%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20Clear%20Int.%20Flag%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20PIT.TIMER%5B0%5D.TFLG%20%3D%201%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20Do%20Something%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3EThanks%20in%20advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1971847%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%5BMPC5777C%5D%20Interrupts%20are%20not%20called%20after%20a%20external%20ISR%20call%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1971847%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThank%20you%20for%20testing%20about%20that.%3C%2FP%3E%3CP%3EThe%20reason%20that%20my%20project%20has%20problem%20is%20my%20fault.%3C%2FP%3E%3CP%3EI%20did%20add%20some%20logging%20code%20in%20ISR%20to%26nbsp%3Bknow%20the%20order%20of%20interrupts%20called.%3C%2FP%3E%3CP%3EIt%20seems%20that%20reading%20INTC.IACKR_PRC%20in%20IRQ%20makes%20interrupt%20wrong.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThank%20you%20so%20much!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1971136%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%5BMPC5777C%5D%20Interrupts%20are%20not%20called%20after%20a%20external%20ISR%20call%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1971136%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20have%20added%20PIT%20to%20the%20External%20IRQ%20example%2C%20but%20I%20don't%20see%20mentioned%20behavior.%3C%2FP%3E%0A%3CP%3EOne%20LED%20is%20blinking%20by%20EIRQ%20button%2C%20second%20by%20PIT%20interrupt.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1966784%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%5BMPC5777C%5D%20Interrupts%20are%20not%20called%20after%20a%20external%20ISR%20call%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1966784%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20don't%20understand%20it%20too%20much%20as%20write%20to%20EOIR%20register%20is%20present%20in%20the%20epilog.%20From%20core%20point%20of%20view%20there%20is%20no%20difference%20between%20external%20interrupt%20and%20other%20IVOR4%20sources.%3C%2FP%3E%0A%3CP%3EI%20will%20check%20it%20on%20HW%20when%20I%20am%20able%2C%20letting%20you%20know.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1966676%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20%5BMPC5777C%5D%20Interrupts%20are%20not%20called%20after%20a%20external%20ISR%20call%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1966676%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EIn%20addition%2C%20prolog%20and%20epilog%20are%20same%20with%20the%20examples%3C%2FLINGO-BODY%3E