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

Again UART2 and UART3 - (not being simulated) - Help Needed

Dear All,

I found lots of threads regarding UART2 and UART3 for LPC2378
With keil simulator not working and , how to work around tom get resolve
This issue using PCONP and all that.

Still I have the same problem.

I am using Keil u-vision 3.11(evaluation version)
and MCB -2300 boards (for both 2368/78).

I have the same problem with both UART(2/3),
I am not getting data on simulator nor
On board (for board I have traced out UART2 lines to the MAX 232 IC as like UART1 on board), It might the separate issue,

but I think first I should able to get data of UART2
On simulator itself later on board.

I have setted up the PCONP register described on this site (as per LPC UM)

(I am able to see data of UART1 and UART2 on simulator on serial windows (UART#0, UART#1) respectively, also I am getting data on board on serial port, but not getting data of UARt2 and UART3)..

My code is as below …

/***** START CODE ***********************/

extern void initSerialAllUart (int BaudRate);
extern SendcharUart0(char);
extern SendcharUart1(char);
extern SendcharUart2(char);
extern SendcharUart3(char);

Main.c
/************************/

Void Main(void)
{ int i;

PCONP |= 1 <<24 ; // Enable UART2
PCONP |= 1<<25; // Enable UART3

initSerialAllUart(9600); //init all uart for 9600 baudrate

for(i=0;i<50;i++) // send 50 character to all ports

{

SendcharUart0(65);

SendcharUart1(66);

SendcharUart2(67);

SendcharUart3(68);

}

}

/*End Main*/

serial.c
/********************************/
void initSerialAllUart (int BD) //Initialize Serial Interface
{

unsigned long Tp; //for baudrate calculation

PINSEL0 |= 0x00000050; //Select UART0-Tx,Rx PINSEL0 |= 0x40000000; //Select UART1-Tx PINSEL1 |= 0x00000001; //Select UART1-Rx PINSEL0 |= 0x00500000; //Select UART2-Tx,Rx PINSEL0|=0xA; //Select UART3-Tx,Rx

/*-----Init UART0 settings--------------*/

U0FDR = 0; /* Fractional divider not used */

U0LCR = 0x80;/* 8 bits, no Parity, 1 Stop bit*/

U0LCR = 0x03;/* DLAB = 0 */

Tp = ((14400000UL / 16UL) + (BD -1)) / BD;

U0LCR |= 0x80; /* Set DLAB */

U0DLL = Tp;

U0DLM = (Tp >> 8);

U0LCR &= ~0x80; /* Clear DLAB */

/*-------Init UART1settings-----------*/

U1FDR = 0; /* Fractional divider not used */

U1LCR = 0x80;/* 8 bits, no Parity, 1 Stop bit*/

U1LCR = 0x03; /* DLAB = 0 */

Tp = ((14400000UL / 16UL) + (BD-1)) / BD;

U1LCR |= 0x80; /* Set DLAB */

U1DLL = Tp;

U1DLM = (Tp >> 8);

U1LCR &= ~0x80; /* Clear DLAB */

/*-----Init UART2settings------------*/

U2FDR = 0;/* Fractional divider not used */

U2LCR = 0x80; /* 8 bits, no Parity, 1 Stop bit*/

U2LCR = 0x03; /* DLAB = 0*/

Tp = ((14400000UL / 16UL) + (BD-1)) / BD;

U2LCR |= 0x80; /* Set DLAB */

U2DLL = Tp;

U2DLM = (Tp >> 8);

U2LCR &= ~0x80; /* Clear DLAB */

/*--Init UART3settings-----------------*/

U3FDR = 0; /* Fractional divider not used */

U3LCR = 0x80; /* 8 bits, no Parity, 1 Stop it*/

U3LCR = 0x03; /* DLAB = 0*/

Tp = ((14400000UL / 16UL) + (BD-1)) / BD;

U3LCR |= 0x80; /* Set DLAB */

U3DLL = Tp;

U3DLM = (Tp >> 8);

U3LCR &= ~0x80; /* Clear DLAB */

}

/*===============================================*/
int SendcharUart0 (int ch)
{

/* Write character to Uart0 */

while (!(U0LSR & 0x20));

return (U0THR = ch);
}

/*===============================================*/

int SendcharUart1 (int ch)
{ /* Write character to Uart1 */

while (!(U1LSR & 0x20));

return (U1THR = ch);
}

/*===============================================*/
int SendcharUart2 (int ch)
{ /* Write character to Uart2 */ while (!(U2LSR & 0x20));

return (U2THR = ch);
}

/*===============================================*/
int SendcharUart3 (int ch)
{ /* Write character to Uart3 */

while (!(U3LSR & 0x20));

return (U3THR = ch);
}

/******END CODEs **************************/

Can anybody guide me, how to get data of UART2 and UART3 over simulator ?!

0