← index #11678PR #8074
Related · high · value 0.799
QUERY · ISSUE

RP2 UART timeout is incorrect

openby peterhinchopened 2023-06-01updated 2023-06-01
bug

To repro link pins 0 and 1 and paste the following:

from machine import UART, Pin
uart = UART(0, 115200, rx=Pin(1, Pin.IN), tx=Pin(0, Pin.OUT), timeout=1000_000, timeout_char=1000_000)
uart.readline()

It times out after 15s rather than 16.6minutes.

Setting a long timeout is a hack to resolve https://github.com/micropython/micropython/issues/10867. In my opinion it should be possible to disable the timeout (set it to infinity). In uasyncio systems, uasyncio should provide any timeouts required by the application.

CANDIDATE · PULL REQUEST

rp2/machine_uart.c: Handle UART RX timeout IRQ.

closedby iabdalkaderopened 2021-12-09updated 2021-12-14
port-rp2

The pico-sdk 1.3.0 update in #8031 introduced a change that broke RP2 Bluetooth UART, and possibly machine_uart.c in general, which stops working right after UART is initialized. This commit https://github.com/raspberrypi/pico-sdk/commit/2622e9bc292a26cb576a80c3c7c30481dda04181 enables the UART receive timeout (RTIM) IRQ, which is asserted when the receive FIFO is not empty, and no more characters are received for a period of time. This PR makes sure the RTIM IRQ is handled and cleared in uart_service_interrupt.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied