stm32/uart: Configure pull-up only on RX and CTS, not TX and RTS.
RX and CTS are the input pins and pull-ups are enabled so they don't cause
a problem if left unconnected. But the output pins don't need a pull up
(they were originally all configured with pull up in commit
8f7491a109
).
If needed, the pull-ups can be disabled in Python using machine.Pin after
the UART is constructed.
See issue #4369.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
a96afae90f
commit
748339b281
@ -474,10 +474,11 @@ bool uart_init(pyb_uart_obj_t *uart_obj,
|
||||
}
|
||||
|
||||
uint32_t mode = MP_HAL_PIN_MODE_ALT;
|
||||
uint32_t pull = MP_HAL_PIN_PULL_UP;
|
||||
|
||||
for (uint i = 0; i < 4; i++) {
|
||||
if (pins[i] != NULL) {
|
||||
// Configure pull-up on RX and CTS (the input pins).
|
||||
uint32_t pull = (i & 1) ? MP_HAL_PIN_PULL_UP : MP_HAL_PIN_PULL_NONE;
|
||||
bool ret = mp_hal_pin_config_alt(pins[i], mode, pull, uart_fn, uart_unit);
|
||||
if (!ret) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user