We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
sorry for the previous post here i am reposting my issue I am trying to configure the UART 3 of MCP2378 for the baud rate 115200.i successfully configured UART0 for the same baud rate .but when i tried it with UART 3 i get some junk values probably due to some baud rate miss match.Clock for both UARTs are same (cclk/4).Did any body configured the port p4.28 and p4.29 for uart 3 if yes please help me . following is the code used for initialization.
int main (void) { u8 ch1; UARTInit(3,112500); while(1) { ch1=UARTByteRead(3); UARTByteSend(3,ch1); } while(1); } u8 UARTByteRead(u8 ucPortNo) { u8 ch; switch(ucPortNo) { case 0: while(!(U0LSR & LSR_RDR)); ch=U0RBR; break; case 1: while(!(U1LSR & LSR_RDR)); ch=U1RBR; break; case 2: while(!(U2LSR & LSR_RDR)); ch=U2RBR; break; case 3: while(!(U3LSR & LSR_RDR)); ch=U3RBR; break; } return(ch); } u8 UARTByteSend(u8 ucPortNo,u8 ucByte) { switch(ucPortNo) { case 0: U0THR =ucByte; while(!(U0LSR & LSR_TEMT )); break; case 1:U1THR =ucByte; while (!(U1LSR & LSR_TEMT )); break; case 2: U2THR = ucByte; while (!(U2LSR & LSR_TEMT)); break; case 3: U3THR = ucByte; while (!(U3LSR & LSR_TEMT)); break; } } void UARTInit(u8 ucPortNo,u16 ucBaudrate) { UART_BaudRateConfig(ucPortNo,ucBaudrate); switch(ucPortNo) { case 0: PINSEL0 =0x00000050; U0FCR =0x07; /* Enable and reset TX and RX FIFO.*/ break; case 1: PINSEL0 |=0x40000000; //original PIN configuration PINSEL1 |=0x00000001; U1FCR =0x07; /* Enable and reset TX and RX FIFO.*/ break; case 2: PCONP |=0x01000000; PINSEL0 |=0x00500000;//selecting thefunction for the pins U2FCR =0x07; /* Enable and reset TX and RX FIFO.*/ break; case 3: PCONP |=0x02000000; // enabling the clock for uart3 PINSEL9 |=0x0f000000;//selecting the function for the pins p4.28 & p4.29 U3FCR =0x07; /* Enable and reset TX and RX FIFO.*/ break; } } UART_BaudRateConfig(u8 PortNo,u16 Baudrate) { u16 DIV; switch(PortNo) { case 0: U0DLM =0x0; U0DLL =8; U0FDR=0x92; U0LCR=0x03; break; case 1:U1LCR =0x83; U1DLM =DIV / 256; U1DLL =DIV % 256; U1LCR=0x03; break; case 2:U2LCR =0x83; U2TER =0x80; U2DLM =0x0; U2DLL =8; U2FDR=0x92; U2LCR =0x03; break; case 3:U3LCR =0x83; U3DLM =0x0; U3DLL =8; U3FDR=0x92; U3LCR=0x03; U3TER =0x80 break; } }