EmbeddedRelated.com
Forums
Memfault Beyond the Launch

UART recieving junk data Help ....

Started by Razio November 28, 2006
Am using a lpc 2148 chip. I have most of the driver's up and working
totally error free but am having real problems with the UART,sending
data had no problems but the only problem was during recieving data

First i tried to test the uart i didn't recieve any inturupts, but as
i read it was a common problem while using the debugger but the real
problem is when i try to recieve data for which I defined a buffer to
read from the U0RBR i had different responses: once i got only oxFF
&/or 0xFE and other times i got the first char only and didn't
recieve the other char's... another time i got the first char and i
read the second char on the U0THR which is supposed to have the same
memmory address as the U0RBR but is used to hold the trasmitted
byte,but no third Char i am aware that whenever i read the U0RBR it
gets cleared but i totally have no clue how to solve that problem coz
most of the times i only get oxFF or oxFE.. am totally new to this so
if anyone can offer me any help or even code sample would be really
appreaciated. I used several terminals to send data first the winXP
hyperterminal then i used the REALTERM, then i used an application we
designed to send and recieve data,,

An Engineer's Guide to the LPC2100 Series

The first and most likely cause is that your baud rate is ever so
slightly out. Check your CPU clock and your clock generator
settings, including the internal periperal clock.

If you can use an oscilloscope, time the transmit and receive
waveforms.

Try a loopback first from/to your PC, then on your CPU.

A common mistake on peoples designs is to inadvertantly invert the
TTL UART signal.

A good test is to loop back the TTL UART signals at the CPU pins,
this tests fully your link from the hosts perspective. Make sure
you set the CPU's pins as inputs or hold the CPU in reset.

Some RS232 drivers have a power down mode, you need to ensure that
the internal TTL signals are pulled to the correct levels when the
driver or receiver is powered down to ensure a proper start bit is
sent & received.
--- In l..., "Razio" wrote:
>
> Am using a lpc 2148 chip. I have most of the driver's up and
working
> totally error free but am having real problems with the
UART,sending
> data had no problems but the only problem was during recieving
data
>
> First i tried to test the uart i didn't recieve any inturupts, but
as
> i read it was a common problem while using the debugger but the
real
> problem is when i try to recieve data for which I defined a buffer
to
> read from the U0RBR i had different responses: once i got only
oxFF
> &/or 0xFE and other times i got the first char only and didn't
> recieve the other char's... another time i got the first char and
i
> read the second char on the U0THR which is supposed to have the
same
> memmory address as the U0RBR but is used to hold the trasmitted
> byte,but no third Char i am aware that whenever i read the U0RBR
it
> gets cleared but i totally have no clue how to solve that problem
coz
> most of the times i only get oxFF or oxFE.. am totally new to this
so
> if anyone can offer me any help or even code sample would be
really
> appreaciated. I used several terminals to send data first the
winXP
> hyperterminal then i used the REALTERM, then i used an application
we
> designed to send and recieve data,,
>
Am using IAR embedded workbench as my compiler, i set up the LCD screen
to print out any char it recieves so i can try it out without using the
debugger, it didn't work out at first, but after a few modifications on
the code, not only did the LCD screen print the char's i sent serially
but also i was able to read them throu the buffer i defined ,, this
worked well for abt 2 hours, then out of the blue i returned to my
first problem which is recieving 0xFE and / 0xFF insted of data, throu
these 2 hours i didn't modify the code i was just testing throu the
serial of my PC and for the whole two hours i didn't get even 1 Char
wrong, now i don't recieve any Char right, am nt sure what the problem
is, is there some bug in my board or wt could i be doing wrong ,,,

Memfault Beyond the Launch