MPC5748g of Processor Expert add External Interrupt question

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

MPC5748g of Processor Expert add External Interrupt question

1,611 Views
Kris_Ke
Contributor III

Dear Sir

I use the DEVKIT-MPC5748G to do external interrupt and the DEVKIT of button are PTA3 and PTE12.

001.png

I am stuck for a while with External interrupt, I can trigger PTE12 into interrupt, but the PA3 can't trigger interrupt.

I use S32_SDK_MPC574xx_BETA_0.9.0 of enet_ping sample code.

Below is my initial code.

void GPIOInit(void)

{

    /* Set Output value LEDs */

    PINS_DRV_ClearPins(LED_PORT, (1 << LED0) | (1 << LED1));

 

    SIUL2->IMCR[155] = SIUL2_IMCR_SSS(1U);

    SIUL2->IMCR[144] = SIUL2_IMCR_SSS(1U);

 

    /* Install buttons ISR */

    INT_SYS_InstallHandler(SIUL_EIRQ_00_07_IRQn, &buttonISR, NULL);

    INT_SYS_InstallHandler(SIUL_EIRQ_08_15_IRQn, &buttonISR, NULL);

 

    INT_SYS_SetPriority(SIUL_EIRQ_00_07_IRQn, 4);

    INT_SYS_SetPriority(SIUL_EIRQ_08_15_IRQn, 5);

 

    /* Enable buttons interrupt */

    INT_SYS_EnableIRQ(SIUL_EIRQ_00_07_IRQn);

    INT_SYS_EnableIRQ(SIUL_EIRQ_08_15_IRQn);

}

1.

And setting the "pin_mux:PingSettings" of PE.

I set the External interrupt 0 is PA3 and  External interrupt 11 is PE12.

002.png

 

2. Change Interrupt Edge to be "Rising edge"

004.png

3. GPIO Set to be input

003.png

4. Pin assigned to be SUL2/eirq/0 and SUL2/eirq11.

006.png

Any suggestions please.

Kris

Labels (1)
0 Kudos
1 Reply

1,035 Views
antleite2001
Contributor I

Hi Kris

I bought a MPC5748g DevKit a few weeks ago and I was facing the same problem.

After some researche I found that the problem is in the code of the file

BlinkingLed_2_Z4_0\SDK\platform\drivers\src\pins\siul2\siul2_hw_access.c

but also depends on the order the file

BlinkingLed_2_Z4_0\Generated_Code\pin_mux.c

is created.

In my case i had  
.pinPortIdx = 3u,  //PA3
...
.intConfig =
{
.eirqPinIdx = 0u,
.intEdgeSel = SIUL2_INT_EITHER_EDGE
},

and 
.pinPortIdx = 17u, //CAN0RX
...
.intConfig =
{
.intEdgeSel = SIUL2_INT_DISABLE
},

In this case the code in will assume, errouneously, for .pinPortIdx = 17u, the value .eirqPinIdx = 0u.

By observation of line 206 of file siul2_hw_access.c 

config->base->IRER0 &= ~pinIntValue;

it can be seen that the first bit of byte config->base->IRER0 will be cleared

Then, Interruptions are enable for PA3 but the bug in the code clears this bit, disabling interruptions for this PA3

The solution is to comment the code in line 206

// config->base->IRER0 &= ~pinIntValue;

and, just to set the code more elegant, change the code in line after the comment

/* External interrupt initialization */

if (config->intConfig.intEdgeSel != SIUL2_INT_DISABLE)
{
     pinIntValue = (1UL << config->intConfig.eirqPinIdx);//This line moved from before the if to here

0 Kudos