Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Interrupts + Keil + LPC2294 again...

Interrupts + Keil + LPC2294 again...

2006-03-26 by grodo2k

Hello
I have a problem; the folowing code, allow to trigger an interrupt via
UART0 but when the interrupt occurs one time it doesn't end. When I
send a char from PC to the LPC I receive 'A' non stop. Can someone say
me, why?

When I use the line: U0IIR_copy = U0IIR;, it ackts same. 
The code:

void UART0INT() __irq
{
	if(toggle)
	{
		IO0CLR |= 0x20000;  //clr P0.17
		toggle = 0;
	}
	else
	{
		IO0SET |= 0x20000;  //set P0.17		
		toggle = 1;
	}
	send_char_u0('A');
	//exit ISR
    //U0IIR_copy = U0IIR;
	VICVectAddr = 0x00000000; //dummy write
}

int main(void) 
{
	PLL_ON();
	LED_init();
	VPBDIV = 0x1;   
	UART0_init();                            
	IO0SET |= 0x20000;  //set P0.17
	send_string_u0(tab);
	VICIntSelect = 0x00000000;
	VICVectAddr1 = (unsigned) UART0INT;
	VICVectCntl1  = 0x26;	//UART0	
	VICIntEnable = 0x40;		//bit 6 = UART0
	U0IER   = 0x00000001;     //enable rx data available interrupt
	while(1)
	{
	  send_char_u0('B');
	}
	
	return 0;

}

P.S. Thanks to Andrew

Re: [lpc2000] Interrupts + Keil + LPC2294 again...

2006-03-26 by Robert Adsett

At 01:12 PM 3/26/2006 +0000, grodo2k wrote:
>Hello
>I have a problem; the folowing code, allow to trigger an interrupt via
>UART0 but when the interrupt occurs one time it doesn't end. When I
>send a char from PC to the LPC I receive 'A' non stop. Can someone say
>me, why?
>
>When I use the line: U0IIR_copy = U0IIR;, it ackts same.
>The code:
>
>void UART0INT() __irq
>{
>         if(toggle)
>         {
>                 IO0CLR |= 0x20000;  //clr P0.17
>                 toggle = 0;
>         }
>         else
>         {
>                 IO0SET |= 0x20000;  //set P0.17
>                 toggle = 1;
>         }
>         send_char_u0('A');
>         //exit ISR
>     //U0IIR_copy = U0IIR;
>         VICVectAddr = 0x00000000; //dummy write
>}

Read the section in the user manual on the IIR.  Different interrupts 
sources require different acknowledgements.  In particular the receive data 
interrupt requires that data be read to acknowledge the interrupt.  Since 
you never read the data the interrupt is never acknowledged.

You also need to enable the FIFO, although you are unlikely to see the 
effect of that until everything else is at least mostly working.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Re: Interrupts + Keil + LPC2294 again...

2006-03-27 by grodo2k

I'll try it, thank you

--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@...> wrote:
>
> At 01:12 PM 3/26/2006 +0000, grodo2k wrote:
> >Hello
> >I have a problem; the folowing code, allow to trigger an interrupt via
> >UART0 but when the interrupt occurs one time it doesn't end. When I
> >send a char from PC to the LPC I receive 'A' non stop. Can someone say
> >me, why?
> >
> >When I use the line: U0IIR_copy = U0IIR;, it ackts same.
> >The code:
> >
> >void UART0INT() __irq
> >{
> >         if(toggle)
> >         {
> >                 IO0CLR |= 0x20000;  //clr P0.17
> >                 toggle = 0;
> >         }
> >         else
> >         {
> >                 IO0SET |= 0x20000;  //set P0.17
> >                 toggle = 1;
> >         }
> >         send_char_u0('A');
> >         //exit ISR
> >     //U0IIR_copy = U0IIR;
> >         VICVectAddr = 0x00000000; //dummy write
> >}
> 
> Read the section in the user manual on the IIR.  Different interrupts 
> sources require different acknowledgements.  In particular the
receive data 
> interrupt requires that data be read to acknowledge the interrupt. 
Since 
> you never read the data the interrupt is never acknowledged.
> 
> You also need to enable the FIFO, although you are unlikely to see the 
> effect of that until everything else is at least mostly working.
> 
> Robert
> 
> " 'Freedom' has no meaning of itself.  There are always
restrictions,   be 
> they legal, genetic, or physical.  If you don't believe me, try to
chew a 
Show quoted textHide quoted text
> radio signal. "  -- Kelvin Throop, III
> http://www.aeolusdevelopment.com/
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.