Fix a bug that Serial driver would read 1Byte garbage data(0xFE).

Serial driver would read 1Byte garbage data(0xFE) at first after reset and start.
pull/933/head
Masao Hamanaka 2015-02-26 16:36:04 +09:00
parent 0365977217
commit 2047acae11
1 changed files with 4 additions and 2 deletions

View File

@ -235,8 +235,6 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
b0 SPB2DT - Serial port break data : High-level */
obj->uart->SCSPTR = 0x0003u; // SPB2IO = 1, SPB2DT = 1
obj->uart->SCSCR = 0x00F0;
/* ---- Line status register (SCLSR) setting ----
b0 ORER - Overrun error detect : clear */
@ -277,6 +275,10 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
uart_data[obj->index].sw_rts.pin = NC;
uart_data[obj->index].sw_cts.pin = NC;
/* ---- Serial control register (SCSCR) setting ---- */
/* Setting the TE and RE bits enables the TxD and RxD pins to be used. */
obj->uart->SCSCR = 0x00F0;
is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
if (is_stdio_uart) {