EmbeddedRelated.com
Forums

LPC21xx and UART0 problem

Started by riccardoventrella February 20, 2007
Hi,
I'm using a MCB2100 with a LPC2129. I've written a sort of home made
printf using the hyperterminal as a debugger window, but up to now I
used UART1 and all went good. Now I have to port my code on a
proprietary board mounting a LPC2194 that has just the UART0 exposed.
I've ported the code to the UART0 in this way:

...init stuff

PINSEL0 = 0x00000005; /* Enable RxD0 and TxD0 */
U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
U0LCR = 0x03; /* DLAB = 0 */
U0FCR = 0x07; /* enable FIFO

....

int putchar (int ch)
{
if (ch == '\n')
{
while (!(U0LSR & 0x20));
U0THR = CR;
}
while (!(U0LSR & 0x20));
return (U0THR = ch);
}

int getchar (void)
{
while (!(U0LSR & 0x01));

return (U0RBR);
}
Unfortunately this code doesn't work and on my hyperterminal set to
9600 baud ( the same condition when I used UART1 ) neither on the
MCB2100 with 2129 nor on the external board with the 2194.
If look in the Serial1 window in uVision3 all works OK, but on the
hyperterminal I see no char.
I've searched through the NET the same problem and it seems to occur
only when you used ISP for uploading the firmware, 'cause it uses the
same port, but this is not my case, 'cause I use the JTAG for this
purpose.

Can you see what is wrong in my code please?

Thanx in advance

Ricky

An Engineer's Guide to the LPC2100 Series

Hi Ricky,

Actually I am also facing the same problem with MCB2100, working fine in UART1 but not in UART0. But if you use simulator on both the ports, the desired output is coming.

The only difference in UART0 to that of UART1 is that UART1 is having the modem support. May be some more register settings needs to configure for UART0; if you find the solution, please let us also know the same.

Best Regards,

abid
On Wed, 21 Feb 2007 riccardoventrella wrote :
>Hi,
>I'm using a MCB2100 with a LPC2129. I've written a sort of home made
>printf using the hyperterminal as a debugger window, but up to now I
>used UART1 and all went good. Now I have to port my code on a
>proprietary board mounting a LPC2194 that has just the UART0 exposed.
>I've ported the code to the UART0 in this way:
>
>...init stuff
>
> PINSEL0 = 0x00000005; /* Enable RxD0 and TxD0 */
> U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
> U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
> U0LCR = 0x03; /* DLAB = 0 */
> U0FCR = 0x07; /* enable FIFO
>
>....
>
>int putchar (int ch)
>{
> if (ch == '\n')
> {
> while (!(U0LSR & 0x20));
> U0THR = CR;
> }
> while (!(U0LSR & 0x20));
> return (U0THR = ch);
>}
>
>int getchar (void)
>{
> while (!(U0LSR & 0x01));
>
> return (U0RBR);
>}
> Unfortunately this code doesn't work and on my hyperterminal set to
>9600 baud ( the same condition when I used UART1 ) neither on the
>MCB2100 with 2129 nor on the external board with the 2194.
>If look in the Serial1 window in uVision3 all works OK, but on the
>hyperterminal I see no char.
>I've searched through the NET the same problem and it seems to occur
>only when you used ISP for uploading the firmware, 'cause it uses the
>same port, but this is not my case, 'cause I use the JTAG for this
>purpose.
>
>Can you see what is wrong in my code please?
>
>Thanx in advance
>
>Ricky
Abid Khan. N,
Lecturer, R&D Engineer-Embedded Systems,
TIFAC-CORE: Advanced Computing and Information Processing,
Shanmugha Arts, Science, Technology & Research Academy (SASTRA) University,
Thanjore-613 402, TN, India.

Phone: +091-09965071698
Fax : +091-4362-264126
I would suggest taking a look at serial data coming out with an
oscilloscope. The only problems I've had with the serial port
programming was around baudrate calculation. I would also verify that
the PCLK is running at the speed you think it is. As I recollect one
bit time at 9600 baud should be 104uSec. -Reed
--- In l..., "Abid Khan" wrote:
>
> Hi Ricky,
>
> Actually I am also facing the same problem with MCB2100, working
fine in UART1 but not in UART0. But if you use simulator on both the
ports, the desired output is coming.
>
> The only difference in UART0 to that of UART1 is that UART1 is
having the modem support. May be some more register settings needs to
configure for UART0; if you find the solution, please let us also
know the same.
>
> Best Regards,
>
> abid
> On Wed, 21 Feb 2007 riccardoventrella wrote :
> >Hi,
> >I'm using a MCB2100 with a LPC2129. I've written a sort of home
made
> >printf using the hyperterminal as a debugger window, but up to now
I
> >used UART1 and all went good. Now I have to port my code on a
> >proprietary board mounting a LPC2194 that has just the UART0
exposed.
> >I've ported the code to the UART0 in this way:
> >
> >...init stuff
> >
> > PINSEL0 = 0x00000005; /* Enable RxD0 and
TxD0 */
> > U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop
bit */
> > U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB
Clock */
> > U0LCR = 0x03; /* DLAB 0 */
> > U0FCR = 0x07; /* enable FIFO
> >
> >....
> >
> >int putchar (int ch)
> >{
> > if (ch == '\n')
> > {
> > while (!(U0LSR & 0x20));
> > U0THR = CR;
> > }
> > while (!(U0LSR & 0x20));
> > return (U0THR = ch);
> >}
> >
> >int getchar (void)
> >{
> > while (!(U0LSR & 0x01));
> >
> > return (U0RBR);
> >}
> >
> >
> > Unfortunately this code doesn't work and on my hyperterminal set
to
> >9600 baud ( the same condition when I used UART1 ) neither on the
> >MCB2100 with 2129 nor on the external board with the 2194.
> >If look in the Serial1 window in uVision3 all works OK, but on the
> >hyperterminal I see no char.
> >I've searched through the NET the same problem and it seems to
occur
> >only when you used ISP for uploading the firmware, 'cause it uses
the
> >same port, but this is not my case, 'cause I use the JTAG for this
> >purpose.
> >
> >Can you see what is wrong in my code please?
> >
> >Thanx in advance
> >
> >Ricky
> >
> >
> >
> >
> Abid Khan. N,
> Lecturer, R&D Engineer-Embedded Systems,
> TIFAC-CORE: Advanced Computing and Information Processing,
> Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
University,
> Thanjore-613 402, TN, India.
>
> Phone: +091-09965071698
> Fax : +091-4362-264126
>
>
>
Hi Abid,
I'm happy to hear from you the same problem, I'm starting to get crazy with this mess.
Honestly I don't know what's wrong, I mean you are right and the onyl difference between the UART0 and UART1 is in modem support and that's why probably the hyperterminal doesn't manage properly the message, 'cause it's a sort of modem emulator.
However I've searched through the NET, and it seems the code is right..I don't know...I don't think it's a problem with the MCB, 'cause as I said the same occurs with the proprietary board having a 2194.
If I'll find a solution, certainly I'll let you know and please do the same in case.

See you

Ricky
----- Messaggio originale -----
Da: Abid Khan
A: l...
Inviato: Mercoled21 febbraio 2007, 4:19:53
Oggetto: RE: [lpc2000] LPC21xx and UART0 problem

Hi Ricky,

Actually I am also facing the same problem with MCB2100, working fine in UART1 but not in UART0. But if you use simulator on both the ports, the desired output is coming.

The only difference in UART0 to that of UART1 is that UART1 is having the modem support. May be some more register settings needs to configure for UART0; if you find the solution, please let us also know the same.

Best Regards,

abid

On Wed, 21 Feb 2007 riccardoventrella wrote :
>Hi,
>I'm using a MCB2100 with a LPC2129. I've written a sort of home made
>printf using the hyperterminal as a debugger window, but up to now I
>used UART1 and all went good. Now I have to port my code on a
>proprietary board mounting a LPC2194 that has just the UART0 exposed.
>I've ported the code to the UART0 in this way:
>
>...init stuff
>
> PINSEL0 = 0x00000005; /* Enable RxD0 and TxD0 */
> U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
> U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
> U0LCR = 0x03; /* DLAB = 0 */
> U0FCR = 0x07; /* enable FIFO
>
>....
>
>int putchar (int ch)
>{
> if (ch == '\n')
> {
> while (!(U0LSR & 0x20));
> U0THR = CR;
> }
> while (!(U0LSR & 0x20));
> return (U0THR = ch);
>}
>
>int getchar (void)
>{
> while (!(U0LSR & 0x01));
>
> return (U0RBR);
>}
> Unfortunately this code doesn't work and on my hyperterminal set to
>9600 baud ( the same condition when I used UART1 ) neither on the
>MCB2100 with 2129 nor on the external board with the 2194.
>If look in the Serial1 window in uVision3 all works OK, but on the
>hyperterminal I see no char.
>I've searched through the NET the same problem and it seems to occur
>only when you used ISP for uploading the firmware, 'cause it uses the
>same port, but this is not my case, 'cause I use the JTAG for this
>purpose.
>
>Can you see what is wrong in my code please?
>
>Thanx in advance
>
>Ricky

Abid Khan. N,
Lecturer, R&D Engineer-Embedded Systems,
TIFAC-CORE: Advanced Computing and Information Processing,
Shanmugha Arts, Science, Technology & Research Academy (SASTRA) University,
Thanjore-613 402, TN, India.

Phone: +091-09965071698
Fax : +091-4362-264126



___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail:
http://it.docs.yahoo.com/nowyoucan.html
Hi Abid,
I think I've discovered the problem, even if I haven't tested it
yet. The difference is effectively in the DTR/CTS missing in the
UART0. When these pins are present, the serial communication is
managed by these ones for initing/ending the transmission, like in a
modem for example.
If you go in the hyperterminal/property/configure dialog, you cad
find a "control flow" combo box, in which you can find the entries:
hardware, XOn/Xoff and none. The hardware entry identifies
a "hardware" way to sinchronize the start/end of the transmission,
and uses the so mentioned pins, the CTS etc. etc.
Probably, as in my case, you left the "hardware" setting on UART0
that hasn't the DTR/CTS pins and hence doesn't work, while in UART1
having them, it works.
You just to set this setting to "None" e all should start to work.

I hope.
Let me know.

Ricky
--- In l..., "Abid Khan" wrote:
>
> Hi Ricky,
>
> Actually I am also facing the same problem with MCB2100, working
fine in UART1 but not in UART0. But if you use simulator on both the
ports, the desired output is coming.
>
> The only difference in UART0 to that of UART1 is that UART1 is
having the modem support. May be some more register settings needs
to configure for UART0; if you find the solution, please let us also
know the same.
>
> Best Regards,
>
> abid
> On Wed, 21 Feb 2007 riccardoventrella wrote :
> >Hi,
> >I'm using a MCB2100 with a LPC2129. I've written a sort of home
made
> >printf using the hyperterminal as a debugger window, but up to
now I
> >used UART1 and all went good. Now I have to port my code on a
> >proprietary board mounting a LPC2194 that has just the UART0
exposed.
> >I've ported the code to the UART0 in this way:
> >
> >...init stuff
> >
> > PINSEL0 = 0x00000005; /* Enable RxD0 and
TxD0 */
> > U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop
bit */
> > U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB
Clock */
> > U0LCR = 0x03; /* DLAB 0 */
> > U0FCR = 0x07; /* enable FIFO
> >
> >....
> >
> >int putchar (int ch)
> >{
> > if (ch == '\n')
> > {
> > while (!(U0LSR & 0x20));
> > U0THR = CR;
> > }
> > while (!(U0LSR & 0x20));
> > return (U0THR = ch);
> >}
> >
> >int getchar (void)
> >{
> > while (!(U0LSR & 0x01));
> >
> > return (U0RBR);
> >}
> >
> >
> > Unfortunately this code doesn't work and on my hyperterminal
set to
> >9600 baud ( the same condition when I used UART1 ) neither on the
> >MCB2100 with 2129 nor on the external board with the 2194.
> >If look in the Serial1 window in uVision3 all works OK, but on the
> >hyperterminal I see no char.
> >I've searched through the NET the same problem and it seems to
occur
> >only when you used ISP for uploading the firmware, 'cause it uses
the
> >same port, but this is not my case, 'cause I use the JTAG for this
> >purpose.
> >
> >Can you see what is wrong in my code please?
> >
> >Thanx in advance
> >
> >Ricky
> >
> >
> >
> >
> Abid Khan. N,
> Lecturer, R&D Engineer-Embedded Systems,
> TIFAC-CORE: Advanced Computing and Information Processing,
> Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
University,
> Thanjore-613 402, TN, India.
>
> Phone: +091-09965071698
> Fax : +091-4362-264126
>
>
>
Try Brays terminal instead of Hyperterminal.



Its freeware, can be downloaded here: HYPERLINK
"http://bray.velenje.cx/avr/terminal/"http://bray.velenje.cx/avr/terminal/
and is very well regarded amongst the folks at AVRFreaks.net



Hope this helps :-)



Kind Regards,

Robin





_____

From: l... [mailto:l...] On Behalf Of
riccardoventrella
Sent: 21 February 2007 15:06
To: l...
Subject: [lpc2000] Re: LPC21xx and UART0 problem


Hi Abid,
I think I've discovered the problem, even if I haven't tested it
yet. The difference is effectively in the DTR/CTS missing in the
UART0. When these pins are present, the serial communication is
managed by these ones for initing/ending the transmission, like in a
modem for example.
If you go in the hyperterminal/-property/-configure dialog, you cad
find a "control flow" combo box, in which you can find the entries:
hardware, XOn/Xoff and none. The hardware entry identifies
a "hardware" way to sinchronize the start/end of the transmission,
and uses the so mentioned pins, the CTS etc. etc.
Probably, as in my case, you left the "hardware" setting on UART0
that hasn't the DTR/CTS pins and hence doesn't work, while in UART1
having them, it works.
You just to set this setting to "None" e all should start to work.

I hope.
Let me know.

Ricky

--- In HYPERLINK "mailto:lpc2000%40yahoogroups.com"l...@yahoogroups-.com,
"Abid Khan" wrote:
>
> Hi Ricky,
>
> Actually I am also facing the same problem with MCB2100, working
fine in UART1 but not in UART0. But if you use simulator on both the
ports, the desired output is coming.
>
> The only difference in UART0 to that of UART1 is that UART1 is
having the modem support. May be some more register settings needs
to configure for UART0; if you find the solution, please let us also
know the same.
>
> Best Regards,
>
> abid
>
>
> On Wed, 21 Feb 2007 riccardoventrella wrote :
> >Hi,
> >I'm using a MCB2100 with a LPC2129. I've written a sort of home
made
> >printf using the hyperterminal as a debugger window, but up to
now I
> >used UART1 and all went good. Now I have to port my code on a
> >proprietary board mounting a LPC2194 that has just the UART0
exposed.
> >I've ported the code to the UART0 in this way:
> >
> >...init stuff
> >
> > PINSEL0 = 0x00000005; /* Enable RxD0 and
TxD0 */
> > U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop
bit */
> > U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB
Clock */
> > U0LCR = 0x03; /* DLAB =
0 */
> > U0FCR = 0x07; /* enable FIFO
> >
> >....
> >
> >int putchar (int ch)
> >{
> > if (ch == '\n')
> > {
> > while (!(U0LSR & 0x20));
> > U0THR = CR;
> > }
> > while (!(U0LSR & 0x20));
> > return (U0THR = ch);
> >}
> >
> >int getchar (void)
> >{
> > while (!(U0LSR & 0x01));
> >
> > return (U0RBR);
> >}
> >
> >
> > Unfortunately this code doesn't work and on my hyperterminal
set to
> >9600 baud ( the same condition when I used UART1 ) neither on the
> >MCB2100 with 2129 nor on the external board with the 2194.
> >If look in the Serial1 window in uVision3 all works OK, but on the
> >hyperterminal I see no char.
> >I've searched through the NET the same problem and it seems to
occur
> >only when you used ISP for uploading the firmware, 'cause it uses
the
> >same port, but this is not my case, 'cause I use the JTAG for this
> >purpose.
> >
> >Can you see what is wrong in my code please?
> >
> >Thanx in advance
> >
> >Ricky
> >
> >
> >
> >
>
>
> Abid Khan. N,
> Lecturer, R&D Engineer-Embedded Systems,
> TIFAC-CORE: Advanced Computing and Information Processing,
> Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
University,
> Thanjore-613 402, TN, India.
>
> Phone: +091-09965071698
> Fax : +091-4362-264126
>
>
>


--

13:44

--

13:44





Hi Robin,
you're really an angel, I've downloaded the Bray's Terminal and
works perfectly, while the Hiperterminal didn't work even if setting
the filter to None.
Thank you very much, you saved me from several headaches :-)

See you

Ricky

--- In l..., "Robin Commander"
wrote:
>
> Try Bray's terminal instead of Hyperterminal.
>
>
>
> It's freeware, can be downloaded here: HYPERLINK
> "http://bray.velenje.cx/avr/terminal/"http://bray.velenje.cx/avr/te
rminal/
> and is very well regarded amongst the folks at AVRFreaks.net
>
>
>
> Hope this helps :-)
>
>
>
> Kind Regards,
>
> Robin
>
>
>
>
>
> _____
>
> From: l... [mailto:l...] On
Behalf Of
> riccardoventrella
> Sent: 21 February 2007 15:06
> To: l...
> Subject: [lpc2000] Re: LPC21xx and UART0 problem
>
>
> Hi Abid,
> I think I've discovered the problem, even if I haven't tested it
> yet. The difference is effectively in the DTR/CTS missing in the
> UART0. When these pins are present, the serial communication is
> managed by these ones for initing/ending the transmission, like in
a
> modem for example.
> If you go in the hyperterminal/-property/-configure dialog, you
cad
> find a "control flow" combo box, in which you can find the
entries:
> hardware, XOn/Xoff and none. The hardware entry identifies
> a "hardware" way to sinchronize the start/end of the transmission,
> and uses the so mentioned pins, the CTS etc. etc.
> Probably, as in my case, you left the "hardware" setting on UART0
> that hasn't the DTR/CTS pins and hence doesn't work, while in
UART1
> having them, it works.
> You just to set this setting to "None" e all should start to work.
>
> I hope.
> Let me know.
>
> Ricky
>
> --- In HYPERLINK "mailto:lpc2000%40yahoogroups.com"lpc2000@...,
> "Abid Khan" wrote:
> >
> > Hi Ricky,
> >
> > Actually I am also facing the same problem with MCB2100, working
> fine in UART1 but not in UART0. But if you use simulator on both
the
> ports, the desired output is coming.
> >
> > The only difference in UART0 to that of UART1 is that UART1 is
> having the modem support. May be some more register settings needs
> to configure for UART0; if you find the solution, please let us
also
> know the same.
> >
> > Best Regards,
> >
> > abid
> >
> >
> > On Wed, 21 Feb 2007 riccardoventrella wrote :
> > >Hi,
> > >I'm using a MCB2100 with a LPC2129. I've written a sort of home
> made
> > >printf using the hyperterminal as a debugger window, but up to
> now I
> > >used UART1 and all went good. Now I have to port my code on a
> > >proprietary board mounting a LPC2194 that has just the UART0
> exposed.
> > >I've ported the code to the UART0 in this way:
> > >
> > >...init stuff
> > >
> > > PINSEL0 = 0x00000005; /* Enable RxD0 and
> TxD0 */
> > > U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop
> bit */
> > > U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB
> Clock */
> > > U0LCR = 0x03; /* DLAB > 0 */
> > > U0FCR = 0x07; /* enable FIFO
> > >
> > >....
> > >
> > >int putchar (int ch)
> > >{
> > > if (ch == '\n')
> > > {
> > > while (!(U0LSR & 0x20));
> > > U0THR = CR;
> > > }
> > > while (!(U0LSR & 0x20));
> > > return (U0THR = ch);
> > >}
> > >
> > >int getchar (void)
> > >{
> > > while (!(U0LSR & 0x01));
> > >
> > > return (U0RBR);
> > >}
> > >
> > >
> > > Unfortunately this code doesn't work and on my hyperterminal
> set to
> > >9600 baud ( the same condition when I used UART1 ) neither on
the
> > >MCB2100 with 2129 nor on the external board with the 2194.
> > >If look in the Serial1 window in uVision3 all works OK, but on
the
> > >hyperterminal I see no char.
> > >I've searched through the NET the same problem and it seems to
> occur
> > >only when you used ISP for uploading the firmware, 'cause it
uses
> the
> > >same port, but this is not my case, 'cause I use the JTAG for
this
> > >purpose.
> > >
> > >Can you see what is wrong in my code please?
> > >
> > >Thanx in advance
> > >
> > >Ricky
> > >
> > >
> > >
> > >
> >
> >
> > Abid Khan. N,
> > Lecturer, R&D Engineer-Embedded Systems,
> > TIFAC-CORE: Advanced Computing and Information Processing,
> > Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
> University,
> > Thanjore-613 402, TN, India.
> >
> > Phone: +091-09965071698
> > Fax : +091-4362-264126
> >
> >
> >
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.441 / Virus Database: 268.18.3/694 - Release Date:
20/02/2007
> 13:44
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.441 / Virus Database: 268.18.3/694 - Release Date:
20/02/2007
> 13:44
>
>
>
well Reed,

Typical XTAL is of 12MHz. The PPL will gives you a clock of 60MHz. But for serial and other peripherals, this clock is divided by 4 and is given to VPB bus; thereby landing with 15MHz clock. For baud rate calculation, you should find D such that (15MHz)/D = 9600, which is your baud rate and truncate this D to the nearest integer will gives you UxDLL and UxDLM with DLAB enabled in U0LSR.

All this is fine for both UARTs. But what makes the data to get into hyper terminal if you connect UART1 is that apart from data Tx and RX you are connecting the control pins of your 9 pin connector and will works fine as you have a modem support for UART1.

But for UART0 only RXD and TXD pins are available, means no more control pins, so connect to your hyper terminal with only your data pins and ground. Just thought this now on the implementation stage will drop a mail my observation after experimenting.

Comment on this approach meanwhile...

Regards,
On Wed, 21 Feb 2007 reed_bement wrote :
>I would suggest taking a look at serial data coming out with an
>oscilloscope. The only problems I've had with the serial port
>programming was around baudrate calculation. I would also verify that
>the PCLK is running at the speed you think it is. As I recollect one
>bit time at 9600 baud should be 104uSec. -Reed
>--- In l..., "Abid Khan" wrote:
> >
> > Hi Ricky,
> >
> > Actually I am also facing the same problem with MCB2100, working
>fine in UART1 but not in UART0. But if you use simulator on both the
>ports, the desired output is coming.
> >
> > The only difference in UART0 to that of UART1 is that UART1 is
>having the modem support. May be some more register settings needs to
>configure for UART0; if you find the solution, please let us also
>know the same.
> >
> > Best Regards,
> >
> > abid
> >
> >
> > On Wed, 21 Feb 2007 riccardoventrella wrote :
> > >Hi,
> > >I'm using a MCB2100 with a LPC2129. I've written a sort of home
>made
> > >printf using the hyperterminal as a debugger window, but up to now
>I
> > >used UART1 and all went good. Now I have to port my code on a
> > >proprietary board mounting a LPC2194 that has just the UART0
>exposed.
> > >I've ported the code to the UART0 in this way:
> > >
> > >...init stuff
> > >
> > > PINSEL0 = 0x00000005; /* Enable RxD0 and
>TxD0 */
> > > U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop
>bit */
> > > U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB
>Clock */
> > > U0LCR = 0x03; /* DLAB >0 */
> > > U0FCR = 0x07; /* enable FIFO
> > >
> > >....
> > >
> > >int putchar (int ch)
> > >{
> > > if (ch == '\n')
> > > {
> > > while (!(U0LSR & 0x20));
> > > U0THR = CR;
> > > }
> > > while (!(U0LSR & 0x20));
> > > return (U0THR = ch);
> > >}
> > >
> > >int getchar (void)
> > >{
> > > while (!(U0LSR & 0x01));
> > >
> > > return (U0RBR);
> > >}
> > >
> > >
> > > Unfortunately this code doesn't work and on my hyperterminal set
>to
> > >9600 baud ( the same condition when I used UART1 ) neither on the
> > >MCB2100 with 2129 nor on the external board with the 2194.
> > >If look in the Serial1 window in uVision3 all works OK, but on the
> > >hyperterminal I see no char.
> > >I've searched through the NET the same problem and it seems to
>occur
> > >only when you used ISP for uploading the firmware, 'cause it uses
>the
> > >same port, but this is not my case, 'cause I use the JTAG for this
> > >purpose.
> > >
> > >Can you see what is wrong in my code please?
> > >
> > >Thanx in advance
> > >
> > >Ricky
> > >
> > >
> > >
> > >
> >
> >
> > Abid Khan. N,
> > Lecturer, R&D Engineer-Embedded Systems,
> > TIFAC-CORE: Advanced Computing and Information Processing,
> > Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
>University,
> > Thanjore-613 402, TN, India.
> >
> > Phone: +091-09965071698
> > Fax : +091-4362-264126
> >
> >
> >
Abid Khan. N,
Lecturer, R&D Engineer-Embedded Systems,
TIFAC-CORE: Advanced Computing and Information Processing,
Shanmugha Arts, Science, Technology & Research Academy (SASTRA) University,
Thanjore-613 402, TN, India.

Phone: +091-09965071698
Fax : +091-4362-264126
Glad to see your problem is solved. I use RealTerm with no flow
control so I've never seen this particular problem. I have had
problems with the simple baud rate calulation (using IAR UART example
code) at low clock speeds. I've also seen a bunch of posts with
similar baud rate calculation confusion...

All the best, -Reed
--- In l..., "Abid Khan" wrote:
>
> well Reed,
>
> Typical XTAL is of 12MHz. The PPL will gives you a clock of 60MHz.
But for serial and other peripherals, this clock is divided by 4 and
is given to VPB bus; thereby landing with 15MHz clock. For baud rate
calculation, you should find D such that (15MHz)/D = 9600, which is
your baud rate and truncate this D to the nearest integer will gives
you UxDLL and UxDLM with DLAB enabled in U0LSR.
>
> All this is fine for both UARTs. But what makes the data to get
into hyper terminal if you connect UART1 is that apart from data Tx
and RX you are connecting the control pins of your 9 pin connector
and will works fine as you have a modem support for UART1.
>
> But for UART0 only RXD and TXD pins are available, means no more
control pins, so connect to your hyper terminal with only your data
pins and ground. Just thought this now on the implementation stage
will drop a mail my observation after experimenting.
>
> Comment on this approach meanwhile...
>
> Regards,
> On Wed, 21 Feb 2007 reed_bement wrote :
> >I would suggest taking a look at serial data coming out with an
> >oscilloscope. The only problems I've had with the serial port
> >programming was around baudrate calculation. I would also verify
that
> >the PCLK is running at the speed you think it is. As I recollect
one
> >bit time at 9600 baud should be 104uSec. -Reed
> >--- In l..., "Abid Khan" wrote:
> > >
> > > Hi Ricky,
> > >
> > > Actually I am also facing the same problem with MCB2100, working
> >fine in UART1 but not in UART0. But if you use simulator on both
the
> >ports, the desired output is coming.
> > >
> > > The only difference in UART0 to that of UART1 is that UART1 is
> >having the modem support. May be some more register settings needs
to
> >configure for UART0; if you find the solution, please let us also
> >know the same.
> > >
> > > Best Regards,
> > >
> > > abid
> > >
> > >
> > > On Wed, 21 Feb 2007 riccardoventrella wrote :
> > > >Hi,
> > > >I'm using a MCB2100 with a LPC2129. I've written a sort of home
> >made
> > > >printf using the hyperterminal as a debugger window, but up to
now
> >I
> > > >used UART1 and all went good. Now I have to port my code on a
> > > >proprietary board mounting a LPC2194 that has just the UART0
> >exposed.
> > > >I've ported the code to the UART0 in this way:
> > > >
> > > >...init stuff
> > > >
> > > > PINSEL0 = 0x00000005; /* Enable RxD0 and
> >TxD0 */
> > > > U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop
> >bit */
> > > > U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB
> >Clock */
> > > > U0LCR = 0x03; /* DLAB > >0 */
> > > > U0FCR = 0x07; /* enable FIFO
> > > >
> > > >....
> > > >
> > > >int putchar (int ch)
> > > >{
> > > > if (ch == '\n')
> > > > {
> > > > while (!(U0LSR & 0x20));
> > > > U0THR = CR;
> > > > }
> > > > while (!(U0LSR & 0x20));
> > > > return (U0THR = ch);
> > > >}
> > > >
> > > >int getchar (void)
> > > >{
> > > > while (!(U0LSR & 0x01));
> > > >
> > > > return (U0RBR);
> > > >}
> > > >
> > > >
> > > > Unfortunately this code doesn't work and on my hyperterminal
set
> >to
> > > >9600 baud ( the same condition when I used UART1 ) neither on
the
> > > >MCB2100 with 2129 nor on the external board with the 2194.
> > > >If look in the Serial1 window in uVision3 all works OK, but on
the
> > > >hyperterminal I see no char.
> > > >I've searched through the NET the same problem and it seems to
> >occur
> > > >only when you used ISP for uploading the firmware, 'cause it
uses
> >the
> > > >same port, but this is not my case, 'cause I use the JTAG for
this
> > > >purpose.
> > > >
> > > >Can you see what is wrong in my code please?
> > > >
> > > >Thanx in advance
> > > >
> > > >Ricky
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > Abid Khan. N,
> > > Lecturer, R&D Engineer-Embedded Systems,
> > > TIFAC-CORE: Advanced Computing and Information Processing,
> > > Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
> >University,
> > > Thanjore-613 402, TN, India.
> > >
> > > Phone: +091-09965071698
> > > Fax : +091-4362-264126
> > >
> > >
> > >
> >
> >
> Abid Khan. N,
> Lecturer, R&D Engineer-Embedded Systems,
> TIFAC-CORE: Advanced Computing and Information Processing,
> Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
University,
> Thanjore-613 402, TN, India.
>
> Phone: +091-09965071698
> Fax : +091-4362-264126
>
>
>
You have to connect to hyper terminal with only TX, RX pins plus ground of UART0 of LPC2129. You will get the data at desired baud-rate. I have got the data on hyper terminal.

In fact as mentioned by other friend about the Bray's terminal software which is one of such GUI where you can read/write the control signals can be used for debugging to directly connect RS232. But for embedded applications where you need to connect the UART0 to other RS232 interface you have to take a connector with these necessary pins.

Now I am thinking of interfacing with the keypad to RS232. Has anybody done this? Please let me know...

Really this forum is helping us a lot virtually. Special Thanks to Keil management.

Best Regards,

On Thu, 22 Feb 2007 reed_bement wrote :
>Glad to see your problem is solved. I use RealTerm with no flow
>control so I've never seen this particular problem. I have had
>problems with the simple baud rate calulation (using IAR UART example
>code) at low clock speeds. I've also seen a bunch of posts with
>similar baud rate calculation confusion...
>
>All the best, -Reed
>--- In l..., "Abid Khan" wrote:
> >
> > well Reed,
> >
> > Typical XTAL is of 12MHz. The PPL will gives you a clock of 60MHz.
>But for serial and other peripherals, this clock is divided by 4 and
>is given to VPB bus; thereby landing with 15MHz clock. For baud rate
>calculation, you should find D such that (15MHz)/D = 9600, which is
>your baud rate and truncate this D to the nearest integer will gives
>you UxDLL and UxDLM with DLAB enabled in U0LSR.
> >
> > All this is fine for both UARTs. But what makes the data to get
>into hyper terminal if you connect UART1 is that apart from data Tx
>and RX you are connecting the control pins of your 9 pin connector
>and will works fine as you have a modem support for UART1.
> >
> > But for UART0 only RXD and TXD pins are available, means no more
>control pins, so connect to your hyper terminal with only your data
>pins and ground. Just thought this now on the implementation stage
>will drop a mail my observation after experimenting.
> >
> > Comment on this approach meanwhile...
> >
> > Regards,
> >
> >
> > On Wed, 21 Feb 2007 reed_bement wrote :
> > >I would suggest taking a look at serial data coming out with an
> > >oscilloscope. The only problems I've had with the serial port
> > >programming was around baudrate calculation. I would also verify
>that
> > >the PCLK is running at the speed you think it is. As I recollect
>one
> > >bit time at 9600 baud should be 104uSec. -Reed
> > >--- In l..., "Abid Khan" wrote:
> > > >
> > > > Hi Ricky,
> > > >
> > > > Actually I am also facing the same problem with MCB2100, working
> > >fine in UART1 but not in UART0. But if you use simulator on both
>the
> > >ports, the desired output is coming.
> > > >
> > > > The only difference in UART0 to that of UART1 is that UART1 is
> > >having the modem support. May be some more register settings needs
>to
> > >configure for UART0; if you find the solution, please let us also
> > >know the same.
> > > >
> > > > Best Regards,
> > > >
> > > > abid
> > > >
> > > >
> > > > On Wed, 21 Feb 2007 riccardoventrella wrote :
> > > > >Hi,
> > > > >I'm using a MCB2100 with a LPC2129. I've written a sort of home
> > >made
> > > > >printf using the hyperterminal as a debugger window, but up to
>now
> > >I
> > > > >used UART1 and all went good. Now I have to port my code on a
> > > > >proprietary board mounting a LPC2194 that has just the UART0
> > >exposed.
> > > > >I've ported the code to the UART0 in this way:
> > > > >
> > > > >...init stuff
> > > > >
> > > > > PINSEL0 = 0x00000005; /* Enable RxD0 and
> > >TxD0 */
> > > > > U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop
> > >bit */
> > > > > U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB
> > >Clock */
> > > > > U0LCR = 0x03; /* DLAB > > >0 */
> > > > > U0FCR = 0x07; /* enable FIFO
> > > > >
> > > > >....
> > > > >
> > > > >int putchar (int ch)
> > > > >{
> > > > > if (ch == '\n')
> > > > > {
> > > > > while (!(U0LSR & 0x20));
> > > > > U0THR = CR;
> > > > > }
> > > > > while (!(U0LSR & 0x20));
> > > > > return (U0THR = ch);
> > > > >}
> > > > >
> > > > >int getchar (void)
> > > > >{
> > > > > while (!(U0LSR & 0x01));
> > > > >
> > > > > return (U0RBR);
> > > > >}
> > > > >
> > > > >
> > > > > Unfortunately this code doesn't work and on my hyperterminal
>set
> > >to
> > > > >9600 baud ( the same condition when I used UART1 ) neither on
>the
> > > > >MCB2100 with 2129 nor on the external board with the 2194.
> > > > >If look in the Serial1 window in uVision3 all works OK, but on
>the
> > > > >hyperterminal I see no char.
> > > > >I've searched through the NET the same problem and it seems to
> > >occur
> > > > >only when you used ISP for uploading the firmware, 'cause it
>uses
> > >the
> > > > >same port, but this is not my case, 'cause I use the JTAG for
>this
> > > > >purpose.
> > > > >
> > > > >Can you see what is wrong in my code please?
> > > > >
> > > > >Thanx in advance
> > > > >
> > > > >Ricky
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > Abid Khan. N,
> > > > Lecturer, R&D Engineer-Embedded Systems,
> > > > TIFAC-CORE: Advanced Computing and Information Processing,
> > > > Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
> > >University,
> > > > Thanjore-613 402, TN, India.
> > > >
> > > > Phone: +091-09965071698
> > > > Fax : +091-4362-264126
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> > Abid Khan. N,
> > Lecturer, R&D Engineer-Embedded Systems,
> > TIFAC-CORE: Advanced Computing and Information Processing,
> > Shanmugha Arts, Science, Technology & Research Academy (SASTRA)
>University,
> > Thanjore-613 402, TN, India.
> >
> > Phone: +091-09965071698
> > Fax : +091-4362-264126
> >
> >
> >
Abid Khan. N,
Lecturer, R&D Engineer-Embedded Systems,
TIFAC-CORE: Advanced Computing and Information Processing,
Shanmugha Arts, Science, Technology & Research Academy (SASTRA) University,
Thanjore-613 402, TN, India.

Phone: +091-09965071698
Fax : +091-4362-264126