Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2119 UART0 Communication problem

hi all

i was trying to communicate the LPC2119 through UART0 module and PC( Hyper Terminal). the code is as follows.

#include<LPC21XX.H>

#define bitset(var,bitno) ((var) |=1<<(bitno))
#define bitclr(var,bitno) ((var) &=~(1<<(bitno)))

#define TEMT (1<<6)
#define LINE_FEED 0XA
#define CARRIAGE_RET 0XD

void init_UART0(void);

int main()
{ unsigned char indx,delay,dummy,result=0;
unsigned char string[] = {"lohia"};
bitset(PINSEL2,2); //configuring port1 pin31-26 as jtag
bitclr(PINSEL2,3); //configuring port1 pin25-16 as GPIO
PINSEL1=0x304500C0; //configuring port0 pin16-31
PINSEL0=0X00008255; //configuring port0 pin0-15
IO1DIR=0x00170000; //making port1.16,17,18,20 as o/p
init_UART0();

while(1)
{ indx=0; while(string[indx]) // Transmit till Null('\0')
{ while(!( U0LSR & TEMT )); //Wait til UOTHR&U0TSR empty

U0THR = string[indx];

dummy = string[indx];

indx++;

for(delay=0x0f;delay--;);
} if(dummy==0)
result=0;
result++;
while(!( U0LSR & TEMT )); //Wait til UOTHR&U0TSRempty
U0THR = LINE_FEED;
U0THR = CARRIAGE_RET;
} }

void init_UART0()
{

U0FCR = 0X07; // Enable FIFO's and reset them
U0LCR = 0X83; // Set DLAB, word length = 8 bits
U0DLL = 0X62; // Baud rate set to 9600
U0DLM = 0X0;
U0LCR = 0X03; // Clear DLAB

}
the hardware required for bus level conversions is also a readymade module(established). iam able to see the data was able pass correctly into dummy variable where as it was not able to go into U0THR ( observed in debug window) sometimes i recieve Framing error and Over run error(observed in debug window). i am not able to find what is the problem.
if there is any problem area that i have to concentrate please let me know

Thanks
VENKAT KIRAN