Hallo and Good afternoon,
please i try to use External interrupt PA3 on MPC5748G but until now not work please if any one has experience with this problem i will be thankful
Code:
int main(void) {
xcptn_xmpl(); /* Configure and Enable Interrupts */
peri_clock_gating();
SIUL2.MSCR[10].B.OBE = 1;
extern_interrupt();
for (;;) {
}
}
void extern_interrupt(void) {
// INTC.PSR[1].B.PRC_SELN1 = 0x4; /* IRQ sent to Core 1 */
// INTC.PSR[1].B.PRIN = 0x0F; /* IRQ priority = 4 (15 = highest) */
SIUL2.IRER0.B.EIRE0 = 1; // CLEAR the flag
SIUL2.IRSR0.B.DIRSR0= 0; // request Enabel
SIUL2.IFEER0.B.IFEE0 = 1;
SIUL2.MSCR[3].B.OBE = 0; // output pin disable
SIUL2.MSCR[3].B.IBE = 1; // input pin enabel
SIUL2.IMCR[144].B.SSS=1; // depend on the datasheet excel
SIUL2.IRER0.B.EIRE0 = 0; // Enabel interrupt flag in 1
}
void extern_ISR(void) {
uint16_t i, j;
for (i = 0; i < 15000; i++)
SIUL2.GPDO[10].R = 1;
for (j = 0; j < 15000; j++)
SIUL2.GPDO[10].R = 0;
SIUL2.IRER0.B.EIRE0 = 1; // disable the flag
}
IRQ.C
void dummy (void);
extern void extern_ISR(void);
(uint32_t) &extern_ISR, /* Vector # 243 SIUL EIRQ [0-7] - SIUL Combined External Interrupt */
(uint32_t) &dummy, /* Vector # 244 SIUL EIRQ [8-15] - SIUL Combined External Interrupt */
(uint32_t) &dummy, /* Vector # 245 SIUL EIRQ [16-23] - SIUL Combined External Interrupt */
(uint32_t) &dummy, /* Vector # 246 SIUL EIRQ [24-31] - SIUL Combined External Interrupt */
Thank you very much
Interrupt flag is needed to clear by write to SIUL2_ISR0 register. not to SIUL2_IRER0.
I could possibly point out following thread:
https://community.nxp.com/t5/MPC5xxx/External-Interrupt-MPC5748g-is-not-working-what-do-I-miss/m-p/7...
Also I would recommend to see following bulleting to understand when use .B and when .R instance:
https://www.nxp.com/docs/en/engineering-bulletin/EB758.pdf