cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt vector number

ssk
Associate II
Posted on February 18, 2015 at 14:22

Hello Members,

I am using SPC560D030 for a product. I have connected PE0 and PB1 to use as wakeup. I want to have system wakeup functionality based on CAN request received (PB1) or when a +5V is applied to a pin PE0. When I try to configure these pins for wakeup using SPC5Studio, it asks for the ISR vector number. I tried assigning number 46 for both the interrupts but it generates an error. As per the reference manual (CD00259063.pdf) table 143: Interrupt Vector Table, these two interrupts fall under WakeUp_IRQ_0 having IRQ ♯ as 46. It looks like my understanding is incorrect for IRQ and ISR vector number. How can I identify the correct ISR vector number for the required wakeup signal? This I want for external interrupt as well.

Thanks in advance for your help.

Mike.

#vector-number
9 REPLIES 9
disirio2
Senior
Posted on February 19, 2015 at 13:51

Hi,

Vector numbers are the first column in the interrupt vectors table into the INTC chapter of the Reference Manual (Table 143. Interrupt vector table).

WKPU IRQs are described in Table 90. Wakeup vector mapping.

Giovanni

ssk
Associate II
Posted on February 19, 2015 at 14:22

Hello Giovanni,

According to table 90, 'WakeUp_IRQ_0' covers 8 different pins as wakeup source. The IRQ # is 46. What will be the ISR vector number for each of the wakeup source for 'WakeUp_IRQ_0'?

Thanks for your reply. Look forward for early reply. Thanks.

Mike.
disirio2
Senior
Posted on February 19, 2015 at 14:25

It would be 46, it is the same.

Giovanni

ssk
Associate II
Posted on February 19, 2015 at 14:31

As per this, if I use the same vector number for two different sources of wakeup, the SPC5Studio gives as error saying invalid 'ISR vector number'. How to handle the single vector number for two different sources?

Thanks in advacne.

Mike.
ssk
Associate II
Posted on February 20, 2015 at 06:37

Hello Members,

I am trying to use two interrupts (WKPU4 and WKPU6) from Wakeup_IRQ_0 (IRQ#46) as below,

OSAL_IRQ_HANDELR(ISR_Wakeup_0)

{

OSAL_IRQ_PROLOGUE();

if (TRUE == (WKUP.WISR.B.EIF[4] & 0x04))

{

/* some code here to handle the int */

}

else if if (TRUE == (WKUP.WISR.B.EIF[6] & 0x06))

{

/* some code here to handle the int */

}

OSAL_IRQ_EPILOGUE();

}

Is this handling correct?

I think that similar handling is required to handle external interrupts i.e. EIRQ[x]. Is my understanding correct?

Thanks in advance for any help.

Mike.

disirio2
Senior
Posted on February 20, 2015 at 10:12

There are several problems in that code. This is what you have to put in the OSAL component:

1) Add an ISR element to the ''ISR Code'' table, enter the new element.

2) Put ''xpc560d.h'' in the ''Headers'' field.

3) Put ''WKPU0'' in ''Identifier'', you may change the name if you want. It is an identifier.

4) Put 46 in ''Number''

5) Put ''ISR_Wakeup_0'' in ''Name Override'', you may also leave this empty if you want to use the default vector name.

6) Put the following code in the ''ISR Code'' box.

/*

 * ${isr_identifier} ISR function (vector ${isr_vector}).

 */

OSAL_IRQ_HANDLER(${isr_name}) {

  uint32_t wisr;

  OSAL_IRQ_PROLOGUE();

  /* Resetting all active IRQs in WISR.*/

  wisr = WKUP.WISR.R;

  WKUP.WISR.R = wisr;

  /* Serving sources I am interested in.*/

  if ((wisr & (1 << 4)) != 0) {

    /* Serving bit 4.*/

  }

  if ((wisr & (1 << 6)) != 0) {

    /* Serving bit 6.*/

  }

  OSAL_IRQ_EPILOGUE();

}

7) Put your code in the above code.

😎 Generate and compile. The code is generated into the osal_cfg.c file in your project.

Giovanni

ssk
Associate II
Posted on February 20, 2015 at 10:55

Thanks Giovanni for your reply.

Though there are mistakes in code, at least this confirmed my understanding.

Thanks for detailed steps. Even without 'xpc560d.h' file, I was able to access the registers, may be I had included the 'components.h' file. It is nice way to clear all the interrupts in one go, as against I was trying to clear individual interrupt inside each 'if' condition.

Thanks again.

Mike.
disirio2
Senior
Posted on February 20, 2015 at 13:58

Hi,

Glad I could help.

Giovanni

ssk
Associate II
Posted on February 20, 2015 at 14:48

Hello Giovanni,

I appreciate your timely help. I have couple of other posts as well,

1. Using Data Flash

2. SPC560D030 - sleep/power down modes

If you could answer to these, that would be of great help.

Thanks in advance for your help.

Mike.