Skip to content

Commit 34d033a

Browse files
committed
Fix mistake register setting in serial_format()
Currently, there is the issue in register setting into serial_format(). The issue is that parameter for baudrate setting is initialed zero in this function. In baudrate is less 9600bps, the issue occurs. In baudrate is over 9600, not occurs. When call serial_baud() before serial_format(), baudrate override and set with an incorrect value. Therefore, I fixed register setting not to set the parameter of baudrate setting in serial_format().
1 parent 88a4baa commit 34d033a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

targets/TARGET_RENESAS/TARGET_RZ_A1H/serial_api.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,11 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
398398
break;
399399
}
400400

401-
obj->serial.uart->SCSMR = data_bits << 6
402-
| parity_enable << 5
403-
| parity_select << 4
404-
| stop_bits << 3;
401+
obj->serial.uart->SCSMR = (obj->serial.uart->SCSMR & ~0x0078)
402+
| (data_bits << 6)
403+
| (parity_enable << 5)
404+
| (parity_select << 4)
405+
| (stop_bits << 3);
405406
}
406407

407408
/******************************************************************************

0 commit comments

Comments
 (0)