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.
hi all , 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 following is the code used for initialization.
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
// PINSEL4 |= 0x000A0000; U2FCR =0x07; /* Enable and reset TX and RX FIFO.*/ break;
case 3: PCONP |=0x02000000; PINSEL9 |=0x0f000000;//selecting the function for the pin // PINSEL1 |= 0x003E0000; U3FCR =0x07; /* Enable and reset TX and RX FIFO.*/
break; } }
UART_BaudRateConfig(u8 PortNo,u16 Baudrate) { u16 DIV; switch(PortNo) { case 0: U0LCR =0x83; // DIV=((Fpclk/16)/Baudrate); // U0DLM = (DIV/256); // U0DLL = (DIV%256); U0DLM =0x0; U0DLL =8;//0xa+;75 /* 38793 =0x1d */ U0FDR=0x92; U0LCR=0x03; break;
case 1:U1LCR =0x83; // DIV=((Fpclk/16)/Baudrate); U1DLM =DIV / 256; U1DLL =DIV % 256; U1LCR=0x03; break;
case 2:U2LCR =0x83; U2TER =0x80; // DIV=((Fpclk/16)/Baudrate); // U2DLM =DIV / 256; // U2DLL =DIV % 256; U2DLM =0x0; U2DLL =8; U2FDR=0x92; U2LCR =0x03; break;
case 3:U3LCR =0x83;
// DIV=((Fpclk/16)/Baudrate); // U3DLM =DIV / 256; // U3DLL =DIV % 256; U3DLM =0x0; U3DLL =8;//0xa+;75 /* 38793 =0x1d */ U3FDR=0x92; U3LCR=0x03; U3TER =0x80; break; } }
here I directly configured the UART for 115200.I am using 24mhz main clock.
hi, For LPC 2378 UART 3 power on bit corresponds to position 25 of PCONP.
hi all, If any body have configured UART3 or UART2 please help me. An early reply is highly awaited .