8000 stm32/uart: Configure pull-up only on RX and CTS, not TX and RTS. · RetiredWizard/micropython@748339b · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 748339b

Browse files
committed
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 8f7491a). If needed, the pull-ups can be disabled in Python using machine.Pin after the UART is constructed. See issue micropython#4369. Signed-off-by: Damien George <damien@micropython.org>
1 parent a96afae commit 748339b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ports/stm32/uart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,11 @@ bool uart_init(pyb_uart_obj_t *uart_obj,
474474
}
475475

476476
uint32_t mode = MP_HAL_PIN_MODE_ALT;
477-
uint32_t pull = MP_HAL_PIN_PULL_UP;
478477

479478
for (uint i = 0; i < 4; i++) {
480479
if (pins[i] != NULL) {
480+
// Configure pull-up on RX and CTS (the input pins).
481+
uint32_t pull = (i & 1) ? MP_HAL_PIN_PULL_UP : MP_HAL_PIN_PULL_NONE;
481482
bool ret = mp_hal_pin_config_alt(pins[i], mode, pull, uart_fn, uart_unit);
482483
if (!ret) {
483484
return false;

0 commit comments

Comments
 (0)
0