cancel
Showing results for 
Search instead for 
Did you mean: 

handling unused interrupts

ezanen9
Associate II
Posted on March 08, 2006 at 15:25

handling unused interrupts

3 REPLIES 3
ezanen9
Associate II
Posted on March 06, 2006 at 10:10

Hi All,

Does someone know if it is possible to catch all unused interrupts sources by putting an one single interrupt routine adress in all the different vectors?

If an unused interrupt is triggert(whatever the source) it will always execute the predefind service routine. In this case a system reset.

This way I can manage all the unused interrupt sources preventing unexpected behaviour due to for example EMC problems.

I tried to point a few different interrupt vertors to the same interrupt service routine but failt to do that.

Does someone have idea's??

Regards,

Jimmey

donald
Associate II
Posted on March 08, 2006 at 09:30

I can read your questions 2 ways.

Multiple Exception Sources

_________________________

Normally you need slightly different code to handle different exceptions in ARM because the return address offset changes. But if you are doing a 'reset' you don't care about the return address. So in this case you can.

The reset on spurious interrupt/exception is a fine and common approach. You need to take care though that your reset on excpetion works properly. For example you should disable FIQ and IRQ (this does not happen for every exception) and you can not make assumptions about the processor mode when setting the first stack pointer (you can be confident you are in a privaleged mode but not which one). You must also reset the peripherals which you could assume were reset when you do a normal reset entry.

Different IRQ sources through EIC

________________________________

If you are talking about all the EIC Vectors that are not used pointing to a special handler then this can be done as well but it is not necessary as you can leave them disabled in the EIC.

Similar reset conditions would apply as for multiple exception handling. The EIC must be reset as it will be in a confused state.

Hope this helps.

ezanen9
Associate II
Posted on March 08, 2006 at 15:25

Hi, and thank you for the information,

In my IDE things about pointing IRQhandlers to vectors are mix with general setups(setting stacks etc) in a Startup.s file.

see attachment for Startup.s

I believe this file is the same as the init.s and the 71x_vect.s from ST together.

In this file there is a lot of code I am not familiar with. I can only read C code:-(. However I think I do see the parts I have to change to point the vectors to the DEFAULT_IRQHandler. I tried and changed things many times but it does not work. The IRQhandlers in my C file are not entered. I don't know what the problem is.

I do get it working with the following code:

//external interrupt EIC configuration

EIC->SIR[XTI_IRQChannel] = ((u16)XTI_IRQHandler << 16);

EIC_IRQChannelPriorityConfig(XTI_IRQChannel,1);

EIC_IRQChannelConfig(XTI_IRQChannel,ENABLE);

void XTI_IRQHandler (void) __irq

{

unsigned int sTimer_druktoets = 0;

XTI_PendingBitClear(XTI_InterruptLineValue()); ADC12->CSR &= ~ADC12_DA3; /*clear sample ready flag*/

/**put something usefull here**********/

EIC->IPR = 1 << XTI_IRQChannel; //reset IRQ

EIC->IPR = 1 << ADC_IRQChannel;

}

This way I can also point the ADC interrupt to the XTI_IRQHandler:

EIC->SIR[ADC_IRQChannel] = ((u16)XTI_IRQHandler << 16);

EIC_IRQChannelConfig(ADC_IRQChannel, ENABLE);

EIC_IRQChannelPriorityConfig(ADC_IRQChannel, 2);

The code above works fine(I know that the interrups reset each other, it's just a test IRQhandler). The external and ADC interrupt are both handeled by the XTI_IRQHandler.

Is there something wrong with this code? If not, can I put the following in my code?

EIC->SIR[T0TIMI_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[FLASH_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[RCCU_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[RTC_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[WDG_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[XTI_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[USBHP_Addr_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[I2C0ITERR_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[I2C1ITERR_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[UART0_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[UART1_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[UART3_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[BSPI0_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[BSPI1_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[I2C0_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[I2C1_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[CAN_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[ADC12_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[T1TIMI_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[T2TIMI_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[T3TIMI_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[HDLC_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[USBLP_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[T0TOI_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[T0OC1_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

EIC->SIR[T0OC2_IRQChannel] = ((u16)DEFAULTIRQHandler << 16);

This way all the above interrupt are handled in the DEFAULTIRQHandler.

void DEFAULT_IRQHandler (void) __irq

{

RCCU_CCR|= 0x0808; //global system reset

}

Is this a proper way to deal with unused interrupt that are triggered accidentally?

Regards,

Jimmey

[ This message was edited by: Jimmey on 09-03-2006 11:12 ]

________________

Attachments :

Startup.s : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtEe&d=%2Fa%2F0X0000000aKa%2F2GI32vH97QQYorTWmBt1ZbQom2j2RgXU6ZFY7soEXfI&asPdf=false