From 2047acae11c80b08a963da34e2bda7305277af92 Mon Sep 17 00:00:00 2001 From: Masao Hamanaka Date: Thu, 26 Feb 2015 16:36:04 +0900 Subject: [PATCH] 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. --- .../targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/serial_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/serial_api.c b/libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/serial_api.c index 83b0004dee..461a5b119f 100644 --- a/libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/serial_api.c +++ b/libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/serial_api.c @@ -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) {