Hi Everybody ,
First of all , Merry Christams and I hope a happy new year for everybody.
May be already answered but I couldn't find it . I tried to read data
from UART0 by initializing exactly based around Insider Guide book
from Hitex . I could not receive data by Hyperterminal . After
checking all parameters , I used Oscilloscope and I had serial data
with correct baud rate . Another software was used but the same
problem exist.
I tried to read data by loop baking UART0 and 1 . ( only connecting
2< - - > 3) with the same initializing and I saw serial data on line.
By overriding putchar ( ) for writing data and getchar ( ) to read
data but it didn't read anything . Any advice is welcomed , it's my code ;
void UART0 (void)
{
PINSEL0 = 0x05; // Select TxD and RxD on pin connect block
U0LCR = 0x80; //Enable programming of divisor latches
U0DLL = 0xC2; //Program the divisor latch for 19200 baud
U0DLM = 0x00;
U0LCR = 0x33; //Program the line control 8\N\1
U0FCR = 0x4F; //enable the FIFO's
}
void UART1 (void)
{
PINSEL0 |=0x050000;
U1LCR = 0x80; //Enable programming of divisor latches
U1DLL = 0xC2; //Program the divisor latch for 19200 baud
U1DLM = 0x00;
U1LCR = 0x33; //Program the line control 8\N\1
U1FCR = 0x4F;
}
int putchar (int ch)
{ /* Write character to Serial Port */
if (ch == '\n')
{
while (!(U0LSR & 0x20));
U0THR = CR; /* output CR */
}
while (!(U0LSR & 0x20));
return (U0THR=ch);
}
int getchar (void)
{
while(!(U1LSR & 0x01 ));
return (U1RBR);
}Message
UART Loop Back
2005-12-28 by majid_mokhtari
Attachments
- No local attachments were found for this message.