EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

EINT2 Problems on LPC2124

Started by fbpmania September 7, 2005
Hello everyone,

ive got a problem with the configuration of the external interrupt
EINT2(P0.15). The controller hangs up after
"VICIntEnable = (1<<VIC_EINT2); // Enable EINT2".

This is my code(gcc):

void EINT2_ISR(void){
toggle_led();
SCB_EXTINT = (1<<2);
VICVectAddr = 0;
}

void init_interrupts(void){
VICVectAddr0 = (unsigned long)EINT2_ISR; // Save ISR Adress
VICVectCntl0 = (1<<5) | (1<<VIC_EINT2); // Enable VIC Control
Register
VICIntEnable = (1<<VIC_EINT2); // Enable EINT2
toggle_led();
}

Here is the pinselect:
PCB_PINSEL0 = (1<<0)|(1<<2)|(1<<31); //UART0 TXD/RXD ,EINT2 on P0.15

And the define for VIC_EINT2:
#define VIC_EINT2 16

I cant recognize any toggles of the LED.

Thanks for your efforts.

Greetings


An Engineer's Guide to the LPC2100 Series

Hello,

For a LPC 2294 i had a problem with EINT2. When i was configurating EXTMODE
(EXTINT in your example) register my program was hanging.

I found solution in errata sheet. There is a problem with EINT2 and VPBDIV.

to program EXTMODE you must follow this procedure :
sauve_VPBDIV = VPBDIV;
VPBDIV = 0;
EXTMODE = 4;
VPBDIV = 4;
VPBDIV = sauve_VPBDIV;

Perhaps you have the same problem on LPC2124 see erra sheet of philipps. ----- Original Message -----
From: "fbpmania" <pmania@pman...>
To: <lpc2000@lpc2...>
Sent: Wednesday, September 07, 2005 11:16 AM
Subject: [lpc2000] EINT2 Problems on LPC2124 Hello everyone,

ive got a problem with the configuration of the external interrupt
EINT2(P0.15). The controller hangs up after
"VICIntEnable = (1<<VIC_EINT2); // Enable EINT2".

This is my code(gcc):

void EINT2_ISR(void){
toggle_led();
SCB_EXTINT = (1<<2);
VICVectAddr = 0;
}

void init_interrupts(void){
VICVectAddr0 = (unsigned long)EINT2_ISR; // Save ISR Adress
VICVectCntl0 = (1<<5) | (1<<VIC_EINT2); // Enable VIC Control
Register
VICIntEnable = (1<<VIC_EINT2); // Enable EINT2
toggle_led();
}

Here is the pinselect:
PCB_PINSEL0 = (1<<0)|(1<<2)|(1<<31); //UART0 TXD/RXD ,EINT2 on P0.15

And the define for VIC_EINT2:
#define VIC_EINT2 16

I cant recognize any toggles of the LED.

Thanks for your efforts.

Greetings
Yahoo! Groups Links



Hey Gilles Faurie,

i checked the Errata sheet and build in the workaround.
Ive modified my Code to this:

void init_interrupts(void){
SCB_MEMMAP = 1; //interrupt vectors reside in flash
toggle_led(28);toggle_led(28);toggle_led(28); // Function Start -
Blink 3 times
VICProtection = 0; //No Protection
VICIntEnClear = 0xffffffff; //Clear all Interrupts

SCB_VPBDIV = 0x00; // --- workaround for EXTINT2 bug
SCB_EXTMODE = 0x04; // set mode for EINT2
SCB_VPBDIV = 0x02; // ---
SCB_VPBDIV = 0x01; // --- end workaround
SCB_EXTINT = 0x04; // clear INT flags
VICIntSelect = 0x00000000; // EINT2 is IRQ
toggle_led(25);
VICIntEnable = (1<<VIC_EINT2); // Enable EINT2
VICVectAddr0 = (unsigned long)EINT2_ISR;
VICVectCntl0 = (1<<5) | (1<<VIC_EINT2);
toggle_led(25);
enableIRQ();
toggle_led(25);
}

EnableIRQ comes from the armVIC.h , which is in the example dir of
WinARM.
My problem is, that the System hangs now on the execution of
"enableIRQ()".

Could it be, that there are some Problems with my Startup Code ?
I use the Startupcode from the UART Example included in WinARM.

Greetings


* fbpmania <pmania@pman...>:
> Could it be, that there are some Problems with
> my Startup Code ? I use the Startupcode from
> the UART Example included in WinARM.

The external interrupts are broken. However
certain specific configurations do work. Search
the list. This has been discussed some weeks ago.

JR



--- In lpc2000@lpc2..., Jean-Rene David <jrdavid@m...> wrote:
> * fbpmania <pmania@t...>:
> > Could it be, that there are some Problems with
> > my Startup Code ? I use the Startupcode from
> > the UART Example included in WinARM.
>
> The external interrupts are broken. However
> certain specific configurations do work. Search
> the list. This has been discussed some weeks ago.
>
> JR
Hello JR,

do you mean the capture/match workaround ?

Greetings


* fbpmania <pmania@pman...>:
> do you mean the capture/match workaround ?

No. I mean the EXTINT.1, EXTINT.2, and VPBDIV.1
workarounds which in fact don't always work.

--
JR



Hey,

If i read the errata sheet you must program VPBDIV as the same value of
EXTMODE. So i think that you must code :

SCB_VPBDIV = 0x00; // --- workaround for EXTINT2 bug
SCB_EXTMODE = 0x04; // set mode for EINT2
SCB_VPBDIV = 0x04; // !!!!!!! --- (!!!!!! to program EXTMODE !!!!!)
SCB_VPBDIV = 0x01; // --- end workaround (!!!!!! true value of VPBDIV
!!!!!!!)
----- Original Message -----
From: "fbpmania" <pmania@pman...>
To: <lpc2000@lpc2...>
Sent: Wednesday, September 07, 2005 4:05 PM
Subject: [lpc2000] Re: EINT2 Problems on LPC2124 Hey Gilles Faurie,

i checked the Errata sheet and build in the workaround.
Ive modified my Code to this:

void init_interrupts(void){
SCB_MEMMAP = 1; //interrupt vectors reside in flash
toggle_led(28);toggle_led(28);toggle_led(28); // Function Start -
Blink 3 times
VICProtection = 0; //No Protection
VICIntEnClear = 0xffffffff; //Clear all Interrupts

SCB_VPBDIV = 0x00; // --- workaround for EXTINT2 bug
SCB_EXTMODE = 0x04; // set mode for EINT2
SCB_VPBDIV = 0x02; // ---
SCB_VPBDIV = 0x01; // --- end workaround
SCB_EXTINT = 0x04; // clear INT flags
VICIntSelect = 0x00000000; // EINT2 is IRQ
toggle_led(25);
VICIntEnable = (1<<VIC_EINT2); // Enable EINT2
VICVectAddr0 = (unsigned long)EINT2_ISR;
VICVectCntl0 = (1<<5) | (1<<VIC_EINT2);
toggle_led(25);
enableIRQ();
toggle_led(25);
}

EnableIRQ comes from the armVIC.h , which is in the example dir of
WinARM.
My problem is, that the System hangs now on the execution of
"enableIRQ()".

Could it be, that there are some Problems with my Startup Code ?
I use the Startupcode from the UART Example included in WinARM.

Greetings
Yahoo! Groups Links



The 2024 Embedded Online Conference