Forums

UART0 not working in GCC LPC2138

Started by ravindra_lpc July 7, 2006
Hi all ,
I had used LPC2138 with Keil ARM Tools.Now I want to switch to GCC .

All interupts except UART0 are working .Although it is going to the
service routine each time I send a character frm UART0 but it is
not printing the Receive Buffer Register (U0RBR) value .The same
code was perfect with Keil ARM Tools.

Why this happening?
Plz resolve this immediately.Code piece is as follows:
void init_UART0 (void)
{
PINSEL0 |= 0x00000005; // Enable RxD0and TxD0

U0LCR = 0x83 ; // 8 bits, no Parity, 1 Stop bit,DLAB=1
U0DLL = 0x00000031; // 38400 Baud Rate @ 30MHz VPB
(PCLK) Clock
U0LCR = 0x03; // DLAB = 0
U0IER = 0x01; // Enable the Receive Data Available(RDA)
interrupt

VICVectCntl0 = 0x20 | 6; // VIC channel=6
VICVectAddr0 =(unsigned long) uart0; // Holds the address of
the ISR
VICIntEnable = 0x00000040; // Hex Mask=0x00000040

}
int putcharUART0(int ch)
{
if (ch == '\n') { // expand LF into CR
+ LF
while (!(U0LSR & 0x20));
U0THR = '\r'; // output CR
}
while (!(U0LSR & 0x20));
return (U0THR = ch);
}
void printUART0(const char *data, ...)
{
unsigned char charcnt = 0;
while(*(data+charcnt) != 0x00)
{
putcharUART0(data[charcnt]);
charcnt++;
}
}
void uart0 (void)
{
unsigned char temp[32];
temp[0] = U0IIR;
temp[0] = U0RBR;
temp[1] =0x00;
printUART0(temp);
VICVectAddr = 0x00000000;
}

for this I m not getting any character in UART .
thanks.

An Engineer's Guide to the LPC2100 Series

Dear Ravindra,

Why should we resolve this and that too immediately?

Do you think that list members are your employee?

Please use better language.
> Why this happening?
> Plz resolve this immediately.Code piece is as follows:

Hehe... I read that and figured it was from someone who has English as a
second or perhaps third language. I don't think he intended it to sound
quite as comandeering as it did.

Andy
-----Original Message-----
From: l... [mailto:l...]On Behalf Of
Mukund Deshmukh
Sent: 07 July 2006 14:36
To: l...
Subject: Re: [lpc2000] UART0 not working in GCC LPC2138
Dear Ravindra,

Why should we resolve this and that too immediately?

Do you think that list members are your employee?

Please use better language.

> Why this happening?
> Plz resolve this immediately.Code piece is as follows:



--- In l..., "Andrew Berney" wrote:
>
> Hehe... I read that and figured it was from someone who has
English as a
> second or perhaps third language. I don't think he intended it to
sound
> quite as comandeering as it did.
>
> Andy
> -----Original Message-----
> From: l... [mailto:l...]On
Behalf Of
> Mukund Deshmukh
> Sent: 07 July 2006 14:36
> To: l...
> Subject: Re: [lpc2000] UART0 not working in GCC LPC2138
> Dear Ravindra,
>
> Why should we resolve this and that too immediately?
>
> Do you think that list members are your employee?
>
> Please use better language.
>
> > Why this happening?
> > Plz resolve this immediately.Code piece is as follows:
>
>
>
>
Hello Mukund & Andy,
I didn't mean tht.Any ways sorry for tht. Really sorry.....
I was wrong.

bye