EmbeddedRelated.com
Forums

EINT0 on LPC2106

Started by frumbub May 9, 2005
Hello

I am having problems with the EINT0 interrupt.
I have searched the posts and tried all suggested sollutions, but my
problem persists.

The problem is that the system stays in the ISR like in an infinite loop.

Code:
void eint_ISR( void )
{
vParTestToggleLED( 0 );
VICVectAddr = ringCLEAR_VIC_INTERRUPT;
}
And thats it... the vParTestToggleLED( 0 ) function just toggles a led
one time, that is verified, but when EINT0 is triggered if flashes
endlessly and the other processes are blocked.

The EINT0 setp code:

VICIntSelect &= ~( RING_VIC_CHANNEL_BIT );
VICIntEnable |= RING_VIC_CHANNEL_BIT;
VICVectAddr2 = ( portLONG ) vRING_ISR;
VICVectCntl2 = RING_VIC_ENABLE | RING_VIC_CHANNEL;

/* Enable EINT0 interrupt. */
PCB_PINSEL1 |= EINT0_ENABLE;

Please help me out...


An Engineer's Guide to the LPC2100 Series

--- In lpc2000@lpc2..., "frumbub" <j_lilje@h...> wrote:
> Hello
>
> I am having problems with the EINT0 interrupt.
> I have searched the posts and tried all suggested sollutions, but my
> problem persists.
>
> The problem is that the system stays in the ISR like in an infinite
loop.
>
> Code:
> void vRING_ISR( void )
> {
> vParTestToggleLED( 0 );
> VICVectAddr = ringCLEAR_VIC_INTERRUPT;
> }
> And thats it... the vParTestToggleLED( 0 ) function just toggles a led
> one time, that is verified, but when EINT0 is triggered if flashes
> endlessly and the other processes are blocked.
>
> The EINT0 setp code:
>
> VICIntSelect &= ~( RING_VIC_CHANNEL_BIT );
> VICIntEnable |= RING_VIC_CHANNEL_BIT;
> VICVectAddr2 = ( portLONG ) vRING_ISR;
> VICVectCntl2 = RING_VIC_ENABLE | RING_VIC_CHANNEL;
>
> /* Enable EINT0 interrupt. */
> PCB_PINSEL1 |= EINT0_ENABLE;
>
> Please help me out...

Forgot these...
/* Constants to setup and access the VIC. */
#define ringCLEAR_VIC_INTERRUPT ( ( unsigned portLONG ) 0 )
#define RING_VIC_CHANNEL ( ( unsigned portLONG ) 0x0E )
#define RING_VIC_CHANNEL_BIT ( ( unsigned portLONG ) 0x4000 )
#define RING_VIC_ENABLE ( ( unsigned portLONG ) 0x20 )
#define EINT0_ENABLE ( ( unsigned portLONG ) 0x01 )
#define ringCLEAR_VIC_INTERRUPT ( ( unsigned portLONG ) 0 )

Corrected the function name, is vRING_ISR and nothing else!

Thanks in advance..


You need to clear the external interrupt (even with level sensitive
interrupts) with like in the following code:

void eint_ISR( void )
{
vParTestToggleLED( 0 );
EXTINT = 1; /* clear EINT0 */
VICVectAddr = 0; /* acknowledge interrupt */
} Richard Duits frumbub wrote:

> Hello
>
> I am having problems with the EINT0 interrupt.
> I have searched the posts and tried all suggested sollutions, but my
> problem persists.
>
> The problem is that the system stays in the ISR like in an infinite loop.
>
> Code:
> void eint_ISR( void )
> {
> vParTestToggleLED( 0 );
> VICVectAddr = ringCLEAR_VIC_INTERRUPT;
> }
> And thats it... the vParTestToggleLED( 0 ) function just toggles a led
> one time, that is verified, but when EINT0 is triggered if flashes
> endlessly and the other processes are blocked.
>
> The EINT0 setp code:
>
> VICIntSelect &= ~( RING_VIC_CHANNEL_BIT );
> VICIntEnable |= RING_VIC_CHANNEL_BIT;
> VICVectAddr2 = ( portLONG ) vRING_ISR;
> VICVectCntl2 = RING_VIC_ENABLE | RING_VIC_CHANNEL;
>
> /* Enable EINT0 interrupt. */
> PCB_PINSEL1 |= EINT0_ENABLE;
>
> Please help me out... >
>
> *>.




Yes that stops th infinite loop, but another problem remains.
It seems that the ISR dont returns. The system freezes.
Any ideas?

--- In lpc2000@lpc2..., Richard Duits <yahoo@r...> wrote:
> You need to clear the external interrupt (even with level sensitive
> interrupts) with like in the following code:
>
> void eint_ISR( void )
> {
> vParTestToggleLED( 0 );
> EXTINT = 1; /* clear EINT0 */
> VICVectAddr = 0; /* acknowledge interrupt */
> } > Richard Duits > frumbub wrote:
>
> > Hello
> >
> > I am having problems with the EINT0 interrupt.
> > I have searched the posts and tried all suggested sollutions, but my
> > problem persists.
> >
> > The problem is that the system stays in the ISR like in an
infinite loop.
> >
> > Code:
> > void eint_ISR( void )
> > {
> > vParTestToggleLED( 0 );
> > VICVectAddr = ringCLEAR_VIC_INTERRUPT;
> > }
> > And thats it... the vParTestToggleLED( 0 ) function just toggles a led
> > one time, that is verified, but when EINT0 is triggered if flashes
> > endlessly and the other processes are blocked.
> >
> > The EINT0 setp code:
> >
> > VICIntSelect &= ~( RING_VIC_CHANNEL_BIT );
> > VICIntEnable |= RING_VIC_CHANNEL_BIT;
> > VICVectAddr2 = ( portLONG ) vRING_ISR;
> > VICVectCntl2 = RING_VIC_ENABLE | RING_VIC_CHANNEL;
> >
> > /* Enable EINT0 interrupt. */
> > PCB_PINSEL1 |= EINT0_ENABLE;
> >
> > Please help me out...
> >
> >
> >
> >

> > *>.
> >
> >


Problem solved!
Thanks for the help. (sometimes it helps just to write down the
problems ;) )

--- In lpc2000@lpc2..., "frumbub" <j_lilje@h...> wrote:
> Yes that stops th infinite loop, but another problem remains.
> It seems that the ISR dont returns. The system freezes.
> Any ideas?
>
> --- In lpc2000@lpc2..., Richard Duits <yahoo@r...> wrote:
> > You need to clear the external interrupt (even with level sensitive
> > interrupts) with like in the following code:
> >
> > void eint_ISR( void )
> > {
> > vParTestToggleLED( 0 );
> > EXTINT = 1; /* clear EINT0 */
> > VICVectAddr = 0; /* acknowledge interrupt */
> > }
> >
> >
> > Richard Duits
> >
> >
> > frumbub wrote:
> >
> > > Hello
> > >
> > > I am having problems with the EINT0 interrupt.
> > > I have searched the posts and tried all suggested sollutions, but my
> > > problem persists.
> > >
> > > The problem is that the system stays in the ISR like in an
> infinite loop.
> > >
> > > Code:
> > > void eint_ISR( void )
> > > {
> > > vParTestToggleLED( 0 );
> > > VICVectAddr = ringCLEAR_VIC_INTERRUPT;
> > > }
> > > And thats it... the vParTestToggleLED( 0 ) function just toggles
a led
> > > one time, that is verified, but when EINT0 is triggered if flashes
> > > endlessly and the other processes are blocked.
> > >
> > > The EINT0 setp code:
> > >
> > > VICIntSelect &= ~( RING_VIC_CHANNEL_BIT );
> > > VICIntEnable |= RING_VIC_CHANNEL_BIT;
> > > VICVectAddr2 = ( portLONG ) vRING_ISR;
> > > VICVectCntl2 = RING_VIC_ENABLE | RING_VIC_CHANNEL;
> > >
> > > /* Enable EINT0 interrupt. */
> > > PCB_PINSEL1 |= EINT0_ENABLE;
> > >
> > > Please help me out...
> > >
> > >
> > >
> > >
>
> > > *>.
> > >
> > >


Is there any way of chosing on what level the interrupt should trigger
(logic 1 or 0)? As it is now it triggers on 0. --- In lpc2000@lpc2..., "frumbub" <j_lilje@h...> wrote:
> Problem solved!
> Thanks for the help. (sometimes it helps just to write down the
> problems ;) )
>
> --- In lpc2000@lpc2..., "frumbub" <j_lilje@h...> wrote:
> > Yes that stops th infinite loop, but another problem remains.
> > It seems that the ISR dont returns. The system freezes.
> > Any ideas?
> >
> > --- In lpc2000@lpc2..., Richard Duits <yahoo@r...> wrote:
> > > You need to clear the external interrupt (even with level sensitive
> > > interrupts) with like in the following code:
> > >
> > > void eint_ISR( void )
> > > {
> > > vParTestToggleLED( 0 );
> > > EXTINT = 1; /* clear EINT0 */
> > > VICVectAddr = 0; /* acknowledge interrupt */
> > > }
> > >
> > >
> > > Richard Duits
> > >
> > >
> > > frumbub wrote:
> > >
> > > > Hello
> > > >
> > > > I am having problems with the EINT0 interrupt.
> > > > I have searched the posts and tried all suggested sollutions,
but my
> > > > problem persists.
> > > >
> > > > The problem is that the system stays in the ISR like in an
> > infinite loop.
> > > >
> > > > Code:
> > > > void eint_ISR( void )
> > > > {
> > > > vParTestToggleLED( 0 );
> > > > VICVectAddr = ringCLEAR_VIC_INTERRUPT;
> > > > }
> > > > And thats it... the vParTestToggleLED( 0 ) function just toggles
> a led
> > > > one time, that is verified, but when EINT0 is triggered if flashes
> > > > endlessly and the other processes are blocked.
> > > >
> > > > The EINT0 setp code:
> > > >
> > > > VICIntSelect &= ~( RING_VIC_CHANNEL_BIT );
> > > > VICIntEnable |= RING_VIC_CHANNEL_BIT;
> > > > VICVectAddr2 = ( portLONG ) vRING_ISR;
> > > > VICVectCntl2 = RING_VIC_ENABLE | RING_VIC_CHANNEL;
> > > >
> > > > /* Enable EINT0 interrupt. */
> > > > PCB_PINSEL1 |= EINT0_ENABLE;
> > > >
> > > > Please help me out...
> > > >
> > > >
> > > >
> > > >
> >

> > > > *>.
> > > >
> > > >


Please download the User Manual for the device you are using and take a
look at the chapter named "System Control Block" section "External
Interrupt Inputs".
Your will find the description for EXTMODE and EXTPOLAR for changing the
mode (edge or level) and polarity.

Richard Duits. frumbub wrote:

> Is there any way of chosing on what level the interrupt should trigger
> (logic 1 or 0)? As it is now it triggers on 0. > --- In lpc2000@lpc2..., "frumbub" <j_lilje@h...> wrote:
> > Problem solved!
> > Thanks for the help. (sometimes it helps just to write down the
> > problems ;) )
> >
> > --- In lpc2000@lpc2..., "frumbub" <j_lilje@h...> wrote:
> > > Yes that stops th infinite loop, but another problem remains.
> > > It seems that the ISR dont returns. The system freezes.
> > > Any ideas?
> > >
> > > --- In lpc2000@lpc2..., Richard Duits <yahoo@r...> wrote:
> > > > You need to clear the external interrupt (even with level sensitive
> > > > interrupts) with like in the following code:
> > > >
> > > > void eint_ISR( void )
> > > > {
> > > > vParTestToggleLED( 0 );
> > > > EXTINT = 1; /* clear EINT0 */
> > > > VICVectAddr = 0; /* acknowledge interrupt */
> > > > }
> > > >
> > > >
> > > > Richard Duits
> > > >
> > > >
> > > > frumbub wrote:
> > > >
> > > > > Hello
> > > > >
> > > > > I am having problems with the EINT0 interrupt.
> > > > > I have searched the posts and tried all suggested sollutions,
> but my
> > > > > problem persists.
> > > > >
> > > > > The problem is that the system stays in the ISR like in an
> > > infinite loop.
> > > > >
> > > > > Code:
> > > > > void eint_ISR( void )
> > > > > {
> > > > > vParTestToggleLED( 0 );
> > > > > VICVectAddr = ringCLEAR_VIC_INTERRUPT;
> > > > > }
> > > > > And thats it... the vParTestToggleLED( 0 ) function just toggles
> > a led
> > > > > one time, that is verified, but when EINT0 is triggered if flashes
> > > > > endlessly and the other processes are blocked.
> > > > >
> > > > > The EINT0 setp code:
> > > > >
> > > > > VICIntSelect &= ~( RING_VIC_CHANNEL_BIT );
> > > > > VICIntEnable |= RING_VIC_CHANNEL_BIT;
> > > > > VICVectAddr2 = ( portLONG ) vRING_ISR;
> > > > > VICVectCntl2 = RING_VIC_ENABLE | RING_VIC_CHANNEL;
> > > > >
> > > > > /* Enable EINT0 interrupt. */
> > > > > PCB_PINSEL1 |= EINT0_ENABLE;
> > > > >
> > > > > Please help me out...
> > > > >
> > > > >
> > > > >
> > > > >
> > >
>
> > > > > *>.
> > > > >
> > > > >
>
> *>.




frumbub wrote:

> Problem solved!
> Thanks for the help. (sometimes it helps just to write down the
> problems ;) )

Indeed.

Could you please share your solution with the list, if you think others
may benefit from it (i.e. avoid the same issue in the future)?
A list works best when people share their knowledge and findings.