EmbeddedRelated.com
Forums

Simpliest working FIQ example - please help.

Started by hansklos2003 March 8, 2004
Hi!

My problem is: how to make an application with EINT0 assigned to FIQ.
I try with someting like below - but it does not work.
The source of interrupt is a pushbutton.
I use IAR EWARM Kickstart compiler.

A fragment of code with init procedure:

...
VICIntSelect = 0x4000; // Select EINT0 as FIQ.
VICIntEnable = 0x4000; // Enable EINT0 interrupt.
PINSEL1 = 0x00000001; // configure P0.16 pin as EINT0.
...

A code with FIQ handler:

...
EXTINT = 0x01; // Try to reset external interrupt flag.
if (!(EXTINT & 0x01))// Check if flag was reset (button not pressed.
{
AND I CAN NOT REACH THIS POINT
}
...

What I may say - something is working - after pushing interrupt
button program hangs.

Robert



An Engineer's Guide to the LPC2100 Series

Have you read the user manual on the LPC part?

There's a number of things you have to do before getting the VIC to
work, one is that if you are running from RAM you have to map the
exception vectors to where flash would be, and the interrupt vector
needs to specific jump instruction.

If you don't do those steps then the normal interrupt vector gets
called, i'm guessing your program is jumping off to that. You might
want to set a breakpoint on the interrupt vector entry in the vector
table.

It's possible that this might not be the problem, I've not seen your
compiler so I don't know what it does on your behalf, however, I did
have the same problem as you and I eventually read the manual
properly and found the cause of the problem.
--- In , "hansklos2003" <hansklos2003@y...>
wrote:
> Hi!
>
> My problem is: how to make an application with EINT0 assigned to
FIQ.
> I try with someting like below - but it does not work.
> The source of interrupt is a pushbutton.
> I use IAR EWARM Kickstart compiler.
>
> A fragment of code with init procedure:
>
> ...
> VICIntSelect = 0x4000; // Select EINT0 as FIQ.
> VICIntEnable = 0x4000; // Enable EINT0 interrupt.
> PINSEL1 = 0x00000001; // configure P0.16 pin as EINT0.
> ...
>
> A code with FIQ handler:
>
> ...
> EXTINT = 0x01; // Try to reset external interrupt flag.
> if (!(EXTINT & 0x01))// Check if flag was reset (button not
pressed.
> {
> AND I CAN NOT REACH THIS POINT
> }
> ...
>
> What I may say - something is working - after pushing interrupt
> button program hangs.
>
> Robert





Hi Robert,

take a look at the Usermanual at page 40 table 8.

You must wait until your signal is '1' to reset the flag.

Unfortunately the external interrupts at the 210x is level-sensitive. Andreas --- In , "hansklos2003" <hansklos2003@y...> wrote:
> Hi!
>
> My problem is: how to make an application with EINT0 assigned to FIQ.
> I try with someting like below - but it does not work.
> The source of interrupt is a pushbutton.
> I use IAR EWARM Kickstart compiler.
>
> A fragment of code with init procedure:
>
> ...
> VICIntSelect = 0x4000; // Select EINT0 as FIQ.
> VICIntEnable = 0x4000; // Enable EINT0 interrupt.
> PINSEL1 = 0x00000001; // configure P0.16 pin as EINT0.
> ...
>
> A code with FIQ handler:
>
> ...
> EXTINT = 0x01; // Try to reset external interrupt flag.
> if (!(EXTINT & 0x01))// Check if flag was reset (button not pressed.
> {
> AND I CAN NOT REACH THIS POINT
> }
> ...
>
> What I may say - something is working - after pushing interrupt
> button program hangs.
>
> Robert




Hi !

Everything is working fine now.
The problem was not in VIC configuration, interrupt vectors mapping
etc...
It was a mistake in linker configuration file (IAR's linker files are
little crazy) for FIQ stack.

Robert --- In , "moostieuk" <moostieuk@y...> wrote:
> Have you read the user manual on the LPC part?
>
> There's a number of things you have to do before getting the VIC to
> work, one is that if you are running from RAM you have to map the
> exception vectors to where flash would be, and the interrupt vector
> needs to specific jump instruction.
>
> If you don't do those steps then the normal interrupt vector gets
> called, i'm guessing your program is jumping off to that. You
might
> want to set a breakpoint on the interrupt vector entry in the
vector
> table.
>
> It's possible that this might not be the problem, I've not seen
your
> compiler so I don't know what it does on your behalf, however, I
did
> have the same problem as you and I eventually read the manual
> properly and found the cause of the problem. >
> --- In , "hansklos2003" <hansklos2003@y...>
> wrote:
> > Hi!
> >
> > My problem is: how to make an application with EINT0 assigned to
> FIQ.
> > I try with someting like below - but it does not work.
> > The source of interrupt is a pushbutton.
> > I use IAR EWARM Kickstart compiler.
> >
> > A fragment of code with init procedure:
> >
> > ...
> > VICIntSelect = 0x4000; // Select EINT0 as FIQ.
> > VICIntEnable = 0x4000; // Enable EINT0 interrupt.
> > PINSEL1 = 0x00000001; // configure P0.16 pin as EINT0.
> > ...
> >
> > A code with FIQ handler:
> >
> > ...
> > EXTINT = 0x01; // Try to reset external interrupt flag.
> > if (!(EXTINT & 0x01))// Check if flag was reset (button not
> pressed.
> > {
> > AND I CAN NOT REACH THIS POINT
> > }
> > ...
> >
> > What I may say - something is working - after pushing interrupt
> > button program hangs.
> >
> > Robert