Hi,
I am now using LM3S9B90 to develop our company’s products. I used UART1 ro received data from PC side COM port (a program written by C# that keeps sending data to M3 with 10400 8n1 speed, no s/w and h/w handshaking). The UART1 initialization code of UART1 is as follows:
void uart1(void)
{
/* Configure the UART 1. */
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinConfigure(GPIO_PD2_U1RX);
GPIOPinConfigure(GPIO_PD3_U1TX);
GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_2 | GPIO_PIN_3);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
SysCtlPeripheralReset(SYSCTL_PERIPH_UART1);
UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), UART1_BAUD, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
//UARTIntRegister(UART1_BASE, uart1_int_handler);
IntEnable(INT_UART1);
UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
//IntPrioritySet(INT_UART1, 0x80);
}
Test1:
I was using pl2303 usb to UART IC from the PC side, the M3 uses MAX3243
I found there is a problem where the received data is wrong when I set:
#define UART1_BAUD 10400
However when I set “#define UART1_BAUD 1200”, the data is correct!
Test2:
Later on, I was using FTDI FT232B usb to UART IC from the PC side, the M3 uses MAX3243.
Both 10400 and 1200 work perfect!
Also, my colleague used LM3S9B90 in other project that uses UART0 to receive data from PC side. He found that some of the data is wrong (wrong rate is around 1%). He used an original COM port from the PC MatherBoard. He is using 19200 8n1, no s/w and h/w handshaking.
May I ask is there any compatibility issues on UART existed in 9B90?
Since then, our projects are now getting stuck in the UART issue. Would you please provide any recommendation for us?
BR,
Barry Mok
I'm not aware of any UART issues on lm3s9b90 that would affect communication based on the baud rate. From my experience, communicating with a "real" RS232 port, I've seen absolutely no problems unless the Stellaris device system clock is set wrongly and, as a result, the UART baud rate is out of spec. When talking to USB-to-serial devices like the pl2303 you mention, I have seen occasional missed data on the PC side, though. The same code runs fine without any missing data if I talk to a PC with a D9 RS232 connector, skipping the USB dongle. I suspect this is a flow control issue, though, since I typically see blocks of data that are missed rather than corrupted characters as I would expect if the baud rate was slightly wrong.
All of our code here tends to use 115,200bps so I'm very surprised that you are seeing problems at such relatively low bit rates. Have you verified that your system clocking is definitely correct and that the baud rate on the wire is exactly as you expect (with an oscilloscope, for example)? Are your RS-232 signals clean? Does one of our evaluation or development kits show the same problem when you connect it to the same PC (our lm3s kits use FTDI232 USB-to-serial devices and our new lm4f ones use a Stellaris part to perform the same function)?
Reading your post again, it seems you are seeing missed data on the lm3s9b90 side. Is all data sent from the 9b90 received correctly on the PC or are you seeing characters missing there too? Are you 100% sure that your software can keep up and no data is being lost in the UART (you are not seeing any receive overrun errors reported)?